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
/** | |
* ## Merging mixin views in backbone.js ## | |
* | |
* really just more a test for tumblr gistr | |
*/ | |
/** | |
* Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. | |
**/ | |
function mergeMixin(view, mixin) { |
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
on run {input} | |
set the_path to POSIX path of input | |
set cmd to "emacsclient -nw " & quoted form of the_path | |
tell application "iTerm" | |
activate | |
set myterm to (make new terminal) | |
tell myterm | |
set number of columns to 120 | |
set number of rows to 60 |
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 App = { | |
Views: { | |
Member: {}, | |
Admin: {}, | |
Misc: {}, | |
Cart: {}, | |
Checkout: {} | |
}, | |
Collections: {}, | |
Controllers: {}, |
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 spinnerOpts = { | |
lines: 10, | |
length: 7, | |
width: 3, | |
radius: 3, | |
trail: 40, | |
speed: 1.0 | |
}; | |
$.fn.spin = function(opts) { |
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
#ifndef COMMON_H__ | |
#define COMMON_H__ | |
#include <inttypes.h> | |
#include <stdarg.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif |
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
/*************************************************************************** | |
* | |
* Input toggles. Previous element is replaced with input box when clicked | |
* | |
***************************************************************************/ | |
$.fn.makeInputToggle = function () { | |
this.each(function () { | |
var that = $(this); | |
if (that.data("inputToggled")) { |
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
/*************************************************************************** | |
* | |
* Input Default fields handling | |
* | |
***************************************************************************/ | |
var origJqueryVal = $.fn.val; | |
$.fn.origVal = origJqueryVal; |
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
/** | |
* Extract the value of all form fields specified in fields. | |
**/ | |
$.fn.getFormData = function (fields) { | |
var res = {}; | |
for (var i = 0; i < fields.length; i++) { | |
var field = fields[i]; | |
res[field] = $(this).find("[name=" + field + "]").val(); | |
} |
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
/** | |
* Start the bootloader by letting the watchdog run out. Safer than | |
* jumping directly into the bootloader. | |
**/ | |
void start_bootloader(void) { | |
cli(); | |
eeprom_write_word(START_MAIN_APP_ADDR, 0); | |
wdt_enable(WDTO_30MS); | |
while(1) {}; | |
} |
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
/** | |
* Convert a mysql timestamp to javascript, taking the timezone into account. | |
**/ | |
function mysqlToDate(timestamp) { | |
var months = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
var regex = /^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])(.*)/; | |
var parts = timestamp.replace(regex,"$2/ $3, $1 $4:$5:$6 GMT$7").split('/'); | |
var str = months[parseInt(parts[0])] + parts[1]; | |
return new Date(str); | |
} |
OlderNewer