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 MyRoute = Ember.Route.extend({ | |
model: function() { | |
// this will resolve | |
return Ember.$.ajax().then(function(data) { | |
// then this will resolve | |
return Ember.RSVP.Promise.all([ | |
Ember.$.ajax({url: data.item1url}), | |
Ember.$.ajax({url: data.item2url}) | |
]).then(function(items) { | |
// and this will be your model in the controller |
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 elementMap = { | |
'char': 'dyn-text-field' | |
}; | |
var DynamicFormField = Ember.Component.extend({ | |
template: Ember.computed('entry.field', function(key, value) { | |
var kind = this.get('entry.field.kind'); | |
var helperName = elementMap[kind] || 'dyn-text-field'; | |
var tmpl = '{{' + helperName + ' entry=entry}}'; | |
return Ember.Handlebars.compile(tmpl); |
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
my $fn = IO::Spec.catdir($?FILE, 'Proto', 'ql2_13x.proto'); | |
use PB::Model::Generator $fn; | |
# => No such method 'IO' for invocant of type 'Any' |
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
constant CURDIR = IO::Spec.splitpath($?FILE)[1]; | |
constant FN = IO::Spec.catdir(CURDIR, 'Proto', 'ql2_13x.proto'); | |
module RethinkDB::Proto { | |
# classes are generated here | |
use PB::Model::Generator FN; | |
} | |
BEGIN { | |
for RethinkDB::Proto::.kv -> \sym, \obj { |
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
### Keybase proof | |
I hereby claim: | |
* I am samuraisam on github. | |
* I am ssutch (https://keybase.io/ssutch) on keybase. | |
* I have a public key whose fingerprint is CB73 AA67 8197 4715 8413 0169 52F3 85BF 58A0 3967 | |
To claim this, I am signing this object: |
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
960a14a3b6c5b785ca2c027d9461374a |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['modal'], | |
didInsertElement: function() { | |
var self = this.$(); | |
Ember.run.later(function() { | |
self.toggleClass('open'); | |
}); |
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
import psycopg2 | |
import uuid | |
import json | |
conn = psycopg2.connect('dbname=ftest user=ffer password=omgnowai') | |
cur = conn.cursor() | |
cur.execute('DROP TABLE IF EXISTS entries') | |
cur.execute(''' | |
CREATE TABLE entries ( | |
id serial PRIMARY KEY, |
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 'webrick' | |
require 'json' | |
require_relative 'health_reporter' | |
module Geronimo | |
# Geronimo::HealthServer is a HTTP server which is intended to run alongside | |
# services which do not have an HTTP server. | |
# | |
# For example, a service like Sidekiq might extend the class to offer | |
# health checks related to Sidekiq functions |
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
""" | |
My dependency injection framework for Python. Using a context manager it allows | |
you to rewrite globals (such as imports, top-level classes and functions, whatever | |
you want) in a module and have them replaced at the end of the with block. This is | |
usually enough. `proxy` is just a dict-wrapping type class which will create a | |
type with "class variables" for every key you give it. | |
Usage: | |
from di import * | |
OlderNewer