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
// example of string interpolation in a mixin | |
// matches a particular color and image together following a naming scheme for the images | |
$green: #7bd939; | |
$orange: #de712c; | |
@mixin sectionhead($color, $name) { | |
.section-head { | |
background-color: $color; | |
background-image: url('../../images/masthead-' + $name + '.jpg'); |
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
python -c "from random import choice; print ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789%^*(-_=+)') for i in range(32)])" |
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
#! /usr/local/bin/python | |
""" | |
Creates a file in the same directory named offline.manifest, | |
or if that file already exists, replaces its contents with project files. | |
To ignore files of a particular type add their file extension to the ignore list. | |
""" | |
import os |
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
{{ value|removetags:"br div p span style"|safe|linebreaks }} |
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
# check memory usage every 15 minutes and if usage matches 90% of allocation, send an email | |
# where _username_ is the username (works on Mac if -u parameter is changed to -U) | |
# where [email protected]_ is who should be emailed | |
# where MAX is the allocated memory (must be an integer) | |
# where LIMIT is the point at which you want to be emailed (must be an integer) | |
*/15 * * * * USAGEF=`ps -u _username_ -o rss,command | grep -v peruser | awk '{sum+=$1} END {print sum/1024}'`; USAGEI=${USAGEF/.*}; MAX=120; LIMIT=108; if [ $USAGEI -gt $LIMIT ]; then echo Usage \($USAGEI\) is approaching or over the maximum allocation \($MAX\) | mail -s "Server is approaching max allocation of memory." [email protected]_; 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
// class manipulation from http://www.openjs.com/scripts/dom/class_manipulation.php | |
function hasClass(ele,cls) { | |
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); | |
} | |
function addClass(ele,cls) { | |
if (!this.hasClass(ele,cls)) ele.className += " "+cls; | |
} | |
function removeClass(ele,cls) { |
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
data_uri = open("sample.png", "rb").read().encode("base64").replace("\n", "") | |
# HTML Image Element | |
img_tag = '<img alt="" src="data:image/png;base64,{0}">'.format(data_uri) | |
print img_tag | |
# CSS Background Image | |
css = 'background-image: url(data:image/png;base64,{0});'.format(data_uri) | |
print css |
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
content: "\2318"; |
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
{% comment %} | |
Display the language representation of that choice instead of the numerical representation. | |
{% endcomment %} | |
{% for member in object_list %} | |
{{ member.get_team_display|lower }} | |
{% endfor %} |
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.onresize = function() { | |
responsiveLoad(); | |
} | |
window.onload = function() { | |
responsiveLoad(); | |
} | |
function responsiveLoad() { | |
console.log('resized'); |
OlderNewer