Skip to content

Instantly share code, notes, and snippets.

@aquam8
aquam8 / 0_reuse_code.js
Created October 11, 2013 03:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aquam8
aquam8 / utils.py
Created January 27, 2012 02:05
Dictionary filtering
#!/bin/env python
# keys is a list of key
def filter_keys(keys, object):
return dict((x,y) for (x, y) in object.iteritems() if x in keys)
# or with keys being one or more keys
def filter_keys2(object, *keys):
return dict((x,y) for (x, y) in object.iteritems() if x in keys)
#
# This is using gem called simple_form by Jose Valim, but it can work with normal Rails calendar_select form inputs
#
<form....>
<%= f.input :target_date, :input_html => {:rel => '{"changeYear":true, "changeMonth":true, "minDate":"+1D", "maxDate":"+12M"}'} %>
</form>