This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Noty 2.2.2 Theme: Flat UI colors | |
* @author kottenator | |
*/ | |
.flat .noty_bar { | |
font: 16px/1.3 Arial, Liberation Sans, sans-serif; | |
text-align: center; | |
padding: 12px 15px 13px; | |
position: relative; | |
border: 2px solid #eee; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Execute a callback when all images have loaded. | |
* needed because .load() doesn't work on cached images | |
* | |
* Usage: | |
* $('img.photo').imagesLoaded(myFunction) | |
* -> myFunction() { this == [jQuery collection of 'img'] } | |
* | |
* $('img.photo').imagesLoaded(myFunction, myContext) | |
* -> myFunction() { this == myContext } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django 'base' app - compressor filters. | |
""" | |
from compressor.filters.css_default import CssAbsoluteFilter | |
class CssRelativeFilter(CssAbsoluteFilter): | |
""" | |
``compressor.filters.css_default.CssAbsoluteFilter`` converts relative URLs to images, fonts, etc | |
in CSS code to absolute URLs like '/static/base/images/logo.svg'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Setup jQuery AJAX | |
* | |
* Requires noty.js and 2 its layouts: noty/layouts/top.js, noty/layouts/topRight.js | |
*/ | |
$.ajaxSetup({ | |
error: function(xhr, status, error) { | |
// we ignore aborted XHR or when user press F5 while XHR is in progress | |
if (status == 'abort' || xhr.readyState == 0) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var button = document.createElement('button'); | |
button.textContent = 'Push'; | |
document.body.appendChild(button); | |
var x, title; | |
if (!history.state) { | |
x = 0; | |
title = document.title; | |
// Without this we can loose the initial page's title on browser navigation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = lambda f: (f - 32) * 5 / 9.; f = lambda c: c * 9 / 5. + 32; print('\n'.join(u'{2:>6} °C ← °F {0:>4} °C → °F {1:6}'.format(i * 10, f(i * 10), round(c(i * 10), 1)) for i in range(-10, 11))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set completion-ignore-case on | |
set show-all-if-ambiguous on | |
set show-all-if-unmodified on | |
# Tab completion | |
TAB: menu-complete | |
# Shift + Tab - backward completion | |
"\e[Z": "\e-1\C-i" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom theme for https://github.com/bash-it/bash-it | |
# Place it into ~/.bash_it/custom/themes/kott/kott.theme.bash | |
# Enable it in your ~/.bashrc: export BASH_IT_THEME='kott' | |
SCM_THEME_PROMPT_DIRTY="✗ " | |
SCM_THEME_PROMPT_CLEAN="✓ " | |
SCM_THEME_PROMPT_PREFIX=" (" | |
SCM_THEME_PROMPT_SUFFIX=")" | |
function scm_prompt_info { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void(function(){var el=document.getElementById('my-grid');if(el){el.style.display=el.style.display=='block'?'none':'block';}else{el=document.createElement('div');document.body.appendChild(el);el.id='my-grid';el.style.cssText='background-image:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'1\' height=\'25.5\'><rect style=\'fill: rgb(255,0,0);\' width=\'1\' height=\'0.25px\' x=\'0\' y=\'0\'/></svg>");position:absolute;left:0;right:0;top:0;z-index:9999;pointer-events:none;background-position:0 3px;display:block;';function resize(){el.style.height=document.body.scrollHeight+'px';}resize();document.body.addEventListener('resize', resize);}}()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Binary tree in-order traversal. | |
* | |
* How would look this simple, straightforward algorithm without recursion? | |
* I don't like recursion, that's one of my attempts to avoid it. | |
*/ | |
function traverseInOrderNoRecursion(t) { | |
if (!t) { | |
return []; | |
} |
OlderNewer