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
''' | |
templatetags module | |
''' | |
from django import template | |
register = template.Library() | |
@register.simple_tag | |
def go_to_url(url): | |
return "window.location='" + url +"'; return false;" |
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
/** | |
* Store view's clientId to the root element's $.data object. | |
*/ | |
var MyView = Backbone.View.extend({ | |
constructor: function(){ | |
var view = this, | |
render; | |
Backbone.View.prototype.constructor.apply(view, arguments); |
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
#!/bin/bash | |
kill -9 `lsof -P -i :5000 | sed -n 's/python *\([0-9]*\).*\:5000.*/\1/p'` |
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
window.dom = { | |
createScriptElement: function(url, async) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", url); | |
if (async !== undefined) { | |
script.async = async; | |
} | |
return script; | |
}, | |
findScriptElementById: function(id) { |
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
PS1='\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\h: \[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;15m\] \\$\[$(tput sgr0)\] ' | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
source /usr/local/git/contrib/completion/git-completion.bash | |
source /usr/local/git/contrib/completion/git-prompt.sh | |
GIT_PS1_SHOWDIRTYSTATE=true | |
PS1='\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\h: \[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\[$(tput sgr0)\]\[\033[38;5;13m\]$(__git_ps1 " (%s)")\[$(tput sgr0)\]\[\033[38;5;15m\] \\$\[$(tput sgr0)\] ' | |
fi |
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
alias rm-orig="find . -name '*.orig' -delete" |
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 gifs = { | |
'imageElementId': 'http://example.com/myimage.gif' | |
} | |
function getUpdateImageSrcFunc(imageId) { | |
return function() { | |
document.getElementById(imageId).src = this.src; | |
} | |
} | |
for (var imageId in gifs) { | |
var gifSrc = gifs[imageId] |
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
import UIKit | |
class KeyboardAvoider { | |
init(for scrollView: UIScrollView) { | |
self.scrollView = scrollView | |
let notificationCenter = NotificationCenter.default | |
notificationCenter.addObserver( | |
self, |
OlderNewer