Skip to content

Instantly share code, notes, and snippets.

class MessagingController < JSQMessagesViewController
alias :'super_collectionView:cellForItemAtIndexPath' :'collectionView:cellForItemAtIndexPath'
attr_accessor :messages, :incomingBubbleImageData, :outgoingBubbleImageData, :garyAvatar
JSQ_MESSAGES_COLLECTION_VIEW_CELL_LABEL_HEIGHT = 20.0
def viewDidLoad
super
@sbauch
sbauch / gist:0f5ebdf71393505fe6f5
Created July 8, 2014 13:54
Echonest & Spotfiy: Taste Profile Create => Update => Playlist => Spotify Web API Lookup
HTTParty.post('http://developer.echonest.com/api/v4/tasteprofile/create',
:body => {:api_key => '#############',
:type => 'general',
:name => 'tester testy'
}
)
=> {"response"=>{"status"=>{"version"=>"4.2", "code"=>0, "message"=>"Success"}, "type"=>"general", "name"=>"tester testy", "id"=>"CAIGHXV147163258A7"}}
@sbauch
sbauch / echo.rb
Created July 6, 2014 17:22
echonest data block
[{:action=>"update", :item=>{:track_id=>"4RL77hMWUq35NYnPLXBpih"}},
{:action=>"update", :item=>{:track_id=>"2kOTgiY7BlXF7wKo65mL7a"}},
{:action=>"update", :item=>{:track_id=>"5crHvEPQ13FbQGQSscm5Ns"}},
{:action=>"update", :item=>{:track_id=>"3rhnT5RoN7bvPUpMHt1aM9"}},
{:action=>"skip", :item=>{:track_id=>"7F06kkQg868sTJRoUWq1d6"}}]
@sbauch
sbauch / gist:7874478
Last active December 30, 2015 19:29
js launch sequence
console.log('Starting Launch Sequence...');
(function launchSequence (i) {
setTimeout(function () {
console.log(i);
if (--i){
launchSequence(i);
}
else {
setTimeout(console.log('BLAST OFF!'), 1000);
}
@sbauch
sbauch / gist:7874453
Created December 9, 2013 15:58
Programming Language Comparison for Sean
puts "Starting Launch Sequence..."
sleep 1
(1..10).to_a.reverse.each do |num|
puts num.to_s
sleep 1
end
puts "BLAST OFF!"
@sbauch
sbauch / index.rb
Created May 6, 2013 23:39
this might help?
get '/' do
# Create Account
company_name = "Company_" + rand(1000000).to_s
new_account = Account.create(name: company_name)
# not sure whats going on here?
# new_account.name = "1 "+ company_name
# new_account.save!
# Create User
@sbauch
sbauch / mobile.scss
Created April 28, 2013 15:41
WIP mobile stylesheet for Discourse
@media only screen and (max-device-width: 540px), only screen and (min-device-width: 560px) and (max-device-width: 1136px) and (-webkit-min-device-pixel-ratio: 2) {
body {
min-width: 320px !important;
max-width: 320px !important;
overflow: hidden;
}
.full-width{width:320px !important;}
#main-outlet {
padding-top: 95px !important;
}
validate :is_employee, :on => :create
def is_employee
if self.email.split("@")[1] == Settings.company_domain
#is employee, do nothing
else
# if i raise 'failed check'.inspect here I confirm that an @gmail.com does not satisfy the above conditional
errors.add(:email, "Not VM employee") #but then no matter what I put here the record still saves
end
end
def self.seed_from_csv(uri)
CSV.read(uri).each do |row|
@post = Post.find_or_create_by_identifier(
:identifier => row[0],
:content => row[1],
:post_type => row[2],
:posted_at => row[5],
:post_impressions_unique => row[6],
:post_impressions_organic_unique => row[7],
@sbauch
sbauch / bw.rb
Created August 6, 2012 18:30 — forked from clayallsopp/gist:3277152
having trouble with bubblewrap
#directory_controller.rb
class DirectoryController < UIViewController
def viewDidLoad
super
self.title = "Directory"
@table = UITableView.alloc.initWithFrame(self.view.bounds)
self.view.addSubview @table
@table.dataSource = self
@table.delegate = self