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
select pk.pkey, tm.schemaname||'.'||tm.tablename, 'create table '||tm.schemaname||'.'||tm.tablename | |
||' (' | |
||cp.coldef | |
-- primary key | |
||decode(pk.pkey,null,'',pk.pkey) | |
-- diststyle and dist key | |
||decode(d.distkey,null,')\n diststyle '||dist_style||' ',d.distkey) | |
--sort key | |
|| (select decode(skey,null,'',skey) from (select |
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 | |
echo "------------------------------------------------------------------------" | |
if [[ "$#" -ne 2 ]]; then | |
echo "IMG Burner -- Built for macbook pros w/ the SD card slot on the right." | |
echo " - Insert a blank SD card" | |
echo " - run with two args - img file and destination disk (typically disk2, disk3, etc. NEVER disk1 or sda1)" | |
echo " - run $ mount to see what disks are available" | |
echo " - Example: $ ./resin.img.burn.sh path/to/resin.img disk2" | |
exit | |
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
define([], function() { | |
/* See also: "Learning Javascript Design Patterns" by Addy Osmani | |
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/ | |
* | |
* for examples on how to use pubsub as event aggregator (Mediator) | |
* | |
*/ | |
var pubsub = function(){}; | |
(function(q) { | |
var topics = {}, subUid = -1; |
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
--- | |
# set up an ssh tunnel | |
# using the following variables | |
# {{AUTOSSH_PUBLIC_KEY_SRC}} | |
# {{AUTOSSH_PUBLIC_KEY_DEST}} | |
# {{AUTOSSH_PRIVATE_KEY_SRC}} | |
# {{AUTOSSH_PRIVATE_KEY_DEST}} | |
# {{AUTOSSH_UPSTART_SRC}} | |
# {{AUTOSSH_UPSTART_DEST}} | |
# {{AUTOSSH_UPSTART_SERVICE}} |
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
Vagrant.configure("2") do |config| | |
config.vm.synced_folder File.dirname(__FILE__)+'/../', "/vagrant-project/" | |
config.vm.define "project_foo" do |app| | |
app.vm.box = "precise64" | |
app.vm.box_url = "http://files.vagrantup.com/precise64.box" |
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
require(['some_module'], // import your module | |
function(mm){ // give it a local reference | |
var MyInstance = new mm({'yo':'ho ho'}); // instantiate it with a value | |
MyInstance.bar(); // run some functions off of it | |
} | |
); |
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
ko.bindingHandlers.console = { | |
init: function (element, valueAccessor,allBindingsAccessor) { | |
console.info('ko.console:',valueAccessor()); | |
}, | |
update: function (element, valueAccessor, allBindingsAccessor) { | |
console.info('ko.console:',valueAccessor()); | |
} | |
}; |
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 Payment = kb.Model.extend({ | |
urlRoot: '/api/v1/payment_backbone/' | |
}); | |
var PaymentCollection = kb.Collection.extend({ | |
model: Payment | |
// Constructor method | |
, initialize: function(data, options) { | |
this.limit = options.limit || 20; |
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
// usage inside a vm: | |
var fooVM = function(){ | |
var self = this; | |
var resource_uri = ko.observable('/api/v1/foo/'); | |
var bar = ko.observable(1); | |
var baz = ko.observable(1); | |
ko.saveOnChange(self,['bar']); | |
} | |
var f = new fooVM(); | |
f.bar(2); // causes a PUT to /api/v1/foo/ |
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
define(['ko','ko.mapping','underscore','moment'], | |
function(ko,mapping,_,moment) { | |
console.log('dashboard VM loaded:',arguments); | |
return function(){ | |
var self = this; | |
}; | |
}); |
NewerOlder