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 http = require('http'), | |
redis = require("redis"), | |
client = redis.createClient(); | |
var io = require('socket.io').listen(3001); | |
var connected_socket; | |
io.sockets.on('connection', function (socket) { | |
client.on("message", function (channel, message) { | |
socket.emit('message', message); |
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 http = require('http'), | |
redis = require("redis"), | |
client = redis.createClient(); | |
var io = require('socket.io').listen(3001); | |
var connected_socket; | |
io.sockets.on('connection', function (socket) { | |
client.on("message", function (channel, message) { | |
socket.emit('message', message); |
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 http = require('http'), | |
redis = require("redis"), | |
client = redis.createClient(); | |
var io = require('socket.io').listen(3001); | |
var connected_socket; | |
io.sockets.on('connection', function (socket) { | |
client.on("message", function (channel, message) { | |
socket.emit('message', message); |
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
# Tested with Ruby 1.9 | |
# Needs gem "guard" (https://github.com/guard/guard) | |
# Needs gem "guard-shell" (https://github.com/guard/guard-shell) | |
# Uses process "growlnotify" (http://growl.info/extras.php) | |
# Uses process "pdflatex" from standard TeXLive distribution | |
guard 'shell' do | |
watch(%r{(.+)\.tex}) do |m| | |
`growlnotify -m #{m[0]} Recompiling` | |
`pdflatex -interaction=batchmode #{m[0]} >/dev/null` |
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
require 'set' | |
LIST = [['A','B','C'], ['A','C','E'], ['E','F','D'],['D','A','J'],['E','D','J']] | |
freq = Hash.new(0) | |
LIST.each do |line| | |
line.combination(2) do |pair| | |
freq[Set.new(pair)] += 1 | |
end | |
end |
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 random | |
secret = random.randint(1, 100) | |
guess = 0 | |
tries = 0 | |
print "AHOY! I'm the Dread Pirate Roberts, and I have a secret!" | |
print "It is a number from 1 to 99. I'll give you 6 tries." | |
while guess != secret and tries < 6: |
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
filteredOwners: Ember.computed('petName', '[email protected].[]', function() { | |
let petName = this.get('petName'); | |
return DS.PromiseArray.create({ | |
promise: Ember.RSVP.filter(this.get('model').toArray(), owner => { | |
return owner.get('pets').then( pets => { | |
return pets.isAny('name', petName); | |
}); | |
}) | |
}); |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myProp: 1, | |
actions: { | |
changeValue() { | |
this.incrementProperty('myProp') | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
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 DS from 'ember-data'; | |
const ActiveModelAdapter = DS.ActiveModelAdapter; | |
const ApplicationAdapter = ActiveModelAdapter.extend({ | |
shouldReloadAll: function(store, snapshotRecordArray) { | |
return true; | |
}, | |
shouldBackgroundReloadRecord: function(store, snapshot) { | |
return false; |