Skip to content

Instantly share code, notes, and snippets.

View omghax's full-sized avatar

Dray Lacy omghax

  • Envy Labs
  • Orlando, FL
View GitHub Profile
MyApp.ItemsListView = SC.TemplateCollectionView.extend(
/** @scope MyApp.ItemsListView.prototype */ {
itemView: SC.TemplateView.extend({
tagsBinding: '.content.tags', // SC.ManyArray
tagNames: function() {
var tags = this.get('tags');
if (tags) return tags.mapProperty('name').join(', ');
}.property('tags.@each.name').cacheable()
})
@omghax
omghax / hswitch.rb
Created July 11, 2011 15:41 — forked from tylerhunt/hswitch.rb
Switches Keys for Multiple Heroku Accounts
#!/usr/bin/ruby
require 'fileutils'
require 'pathname'
account = ARGV.first
unless account
puts "Usage: #{File.basename(__FILE__)} <account>"
exit(1)
end
@omghax
omghax / Buildfile
Created July 19, 2011 20:42
Bug in SC.SplitView / SC.ContainerView?
config :app, :required => ['sproutcore', 'sproutcore/experimental/split_view']
@omghax
omghax / gist:1832850
Created February 15, 2012 03:11
DonorsChoose
require 'cgi'
require 'uri'
require 'net/http'
require 'json'
require 'ostruct'
class DonorsChoose
def initialize(api_key)
@api_key = api_key
end
require 'active_support/json'
module Visitor
DISPATCH = Hash.new do |hash, klass|
hash[klass] = "visit_#{klass.name.gsub('::', '__')}"
end
def visit(object, options={})
send(DISPATCH[object.class], object, options)
rescue NoMethodError
def self.text_search(query)
if query.present?
fulltext_columns = ['vechicles.make', 'vehicles.model']
fulltext_columns += columns.select do |col|
col.type == :string || col.type == :text
end.collect do |col|
"lot_vehicles.#{col.name}"
end
conditions = fulltext_columns.collect { |col| "#{col} @@ :q" }.join(' OR ')
joins(:vehicle).where(conditions, :q => query)

Keybase proof

I hereby claim:

  • I am omghax on github.
  • I am draylacy (https://keybase.io/draylacy) on keybase.
  • I have a public key whose fingerprint is 2EC2 6761 8CA5 B64D 3306 D1BA C31B 71C6 8ED5 C150

To claim this, I am signing this object:

import Component from 'ember-component';
import { StyleSheet } from 'aphrodite';
export default Component.extend({
styles: StyleSheet.create({
red: {
backgroundColor: 'red'
},
blue: {
import Ember from 'ember';
import move from 'ember-animated/motions/move';
export default Ember.Component.extend({
transition({ insertedSprites, keptSprites, removedSprites }) {
removedSprites.forEach(sprite => {
sprite.endAtPixel({ x: window.innerWidth });
move(sprite);
});
keptSprites.forEach(move);
@omghax
omghax / controllers.index.js
Last active April 10, 2018 19:29
New Twiddle
import Ember from 'ember';
import { toLeft, toRight } from 'ember-animated/transitions/move-over';
export default Ember.Controller.extend({
activeTab: 1,
rules({ firstTime, newItems, oldItems }) {
if (firstTime) {
return;
}