This file contains hidden or 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 root.utils.ViewportHeight | |
'The VH unit is not well supported. Use data-tags instead. | |
data-viewport-unit="line-height: 100vh; height: 100vh;' | |
constructor: ({@element, @styles}={}) -> | |
@$element = $ @element | |
@$window = $ window | |
@_bindHandlers() | |
_getStyles: -> |
This file contains hidden or 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 logging | |
import pylibmc | |
from werkzeug.contrib.cache import MemcachedCache | |
from flask import request | |
from flask.ext.cache import Cache | |
log = logging.getLogger(__name__) |
This file contains hidden or 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
# very simple git revision based cache buster | |
app = make_app() | |
def get_git_revision_hash(): | |
''' | |
Get current revision short hash and use as cache buster key. | |
''' | |
import subprocess | |
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']) |
This file contains hidden or 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
<link href="/static/css/select2.css" type="text/css" media="screen" rel="stylesheet" /> | |
<script type="text/javascript" src="/static/js/select2.js"></script> | |
<script type="text/javascript"> | |
$(function () { | |
select2Options = { | |
'width': 'resolve', | |
} | |
$("#content-main select:not(.select2-offscreen)").select2(select2Options); |
This file contains hidden or 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 validation logic | |
$.validator.addMethod 'validateShipState', (value, element) -> | |
# if the element contains an arbitrary piece of data called `custom-validator-exception`, don't allow form to validate. | |
if $(element).data('custom-validator-exception') | |
return false | |
return true | |
, -> | |
return $("[name=s_state]").data('custom-validator-exception') |
This file contains hidden or 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 fitPhotoTargetSelector = name + " .fittingbox-fitphoto-target"; | |
window.fitPhoto = FitPhoto.create(fitPhotoTargetSelector, { | |
width: 327, | |
glassID: glassID, | |
localeChain: 'en_US' | |
}); | |
// handle change sku | |
$actionContainer.find('.fittingbox-sku').unbind('click').click(function() { | |
var sku = $(this).data('sku'); |
This file contains hidden or 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
def pull_down_remote_db(): | |
""" Export database and files. | |
""" | |
local_db_dump_path = os.path.join(PROJECT_ROOT, 'remote_db_dump/auto_db_dump.sql') | |
with settings(sudo_user='postgres'): | |
with cd('/var/lib/postgresql'): | |
run('pwd') | |
print("Dumping database on remote..") | |
sudo('pg_dump db_krownlab > auto_db_dump.sql') |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
<div class="cart__options"> | |
{% for i in (0..2) %} | |
{% assign variant_option_key = i | plus: 1 | prepend: "option" %} | |
{% assign variant_value = item.variant[variant_option_key] %} | |
{% if variant_value %} | |
<div class="cart__option"> | |
{{ item.product.options[i] }}: {{ variant_value }} | |
</div> | |
{% endif %} | |
{% endfor %} |