Skip to content

Instantly share code, notes, and snippets.

View fivetwentysix's full-sized avatar
💭
yet another programmer

Patrick Ma fivetwentysix

💭
yet another programmer
View GitHub Profile
DemoApp.PlayersShowController = Ember.ObjectController.extend
swords: Ember.$.getJSON '/swords'
matches: (->
@get('model.matches').map (match) ->
sword = swords.findBy('external_id', match.sword_id)
name = sword.name.replace('lalala_', '')
match.sword =
img: "/images/sword_#{name}_sb.png"
DemoApp.PlayersShowRoute = Ember.Route.extend
model: (params) ->
Ember.$.getJSON '/players/' + params.id
DemoApp.PlayersShowRoute = Ember.Route.extend
model: (params) ->
Ember.$.getJSON '/players/' + params.id
DemoApp.PlayersRoute = Ember.Route.extend
model: ->
Ember.$.getJSON '/players'
DemoApp.PlayersShowRoute = Ember.Route.extend
model: (params) ->
Ember.$.getJSON '/players/' + params.id
@fivetwentysix
fivetwentysix / gist:e0f97330d5ab1fb5ea73
Last active August 29, 2015 14:03
This sorting code runs really slow after sorting a few times!
DemoApp.PlayersShowController = Ember.ObjectController.extend
needs: 'application'
filteredMatches: ( ->
hero_id = @get('model.filters.hero_id')
if hero_id
@get('model.matches').filterBy('hero_id', hero_id)
else
@get('model.matches')
).property('model.filters.hero_id')
apt_repository 'postgresql-9.3' do
uri 'http://ppa.launchpad.net/chris-lea/postgresql-9.3/ubuntu'
distribution 'precise'
components ['main']
keyserver 'keyserver.ubuntu.com'
key 'D878D6C2'
deb_src true
end
execute 'apt-key-update' do
➜ ~ nmap 172.20.10.0/24
Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-29 10:22 PDT
Nmap scan report for 172.20.10.1
Host is up (0.00092s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
21/tcp open ftp
62078/tcp open iphone-sync
@fivetwentysix
fivetwentysix / gist:713109
Created November 24, 2010 04:25
backup.rb
notifier_settings do
to "john@gmail.com"
from "john@gmail.com"
smtp do
host "mail.google.com.com"
port "587"
username "john"
password "password"
formElement.addEvent('submit', function(e) {
e.stop();
this.send();
});
# GET /replies/1
def show
if request.xhr?
@reply = Reply.find(params[:id])
render :partial => 'instruction_items/reply', :locals => {:reply => @reply}
end
end