Skip to content

Instantly share code, notes, and snippets.

View levicole's full-sized avatar

Levi Cole levicole

  • Kolide
  • Nashville, TN
View GitHub Profile
/usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:378:in `load_environment!': (eval):88:in `load_environment!': compile error (SyntaxError)
(eval):19: syntax error, unexpected ']', expecting kEND
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:366:in `eval'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:378:in `load_environment!'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:366:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:37:in `new'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore/library.rb:37:in `library_for'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/lib/sproutcore.rb:11:in `library'
from /usr/local/lib/ruby/gems/1.8/gems/sproutcore-0.9.19/bin/sc-server:41
from /usr/local/bin/sc-server:19:in `load'
<%= form :action => resource(:uploads) do %>
<%= file_field :name => "file", :label => "file" %><br />
<%= submit "send" %>
<% end =%>
require 'hotcocoa'
include HotCocoa
application do |app|
# setting up our window with
window :size => [150, 50] do |win|
# now lets set up our layout
win.view = layout_view :mode => :horizontal do |layout|
layout.spacing = 5
# make a button
b = button(:title => 'Hi!', :layout => { :align => :center})
puts "Hello world, I am testing out posting to gist from vim"
def search
@artists = Artist.find_all_by_festival_id(@festival.id, :conditions => ["name LIKE ?", "%#{params[:q]}%"])
respond_to do |wants|
wants.js { render :json => @artists }
end
end
it "should be ok" do
get "/api/fakeguid/events"
Rails.logger.info "#{response.inspect}"
response.should be_ok
end
# results of response.inspect
#<Rack::MockResponse:0x36a6898 @headers={"Content-Type"=>"text/html", "Content-Length"=>"414"}, @errors="", @original_headers={"Content-Type"=>"text/html", "Content-Length"=>"414"}, @body="<!DOCTYPE html>\n<html>\n<head>\n <style type=\"text/css\">\n body { text-align:center;font-family:helvetica,arial;font-size:22px;\n color:#888;margin:20px}\n #c {margin:0 auto;width:500px;text-align:left}\n </style>\n</head>\n<body>\n <h2>Sinatra doesn't know this ditty.</h2>\n <img src='/__sinatra__/404.png'>\n <div id=\"c\">\n Try this:\n <pre>get '/hello' do\n \"Hello World\"\nend</pre>\n </div>\n</body>\n</html>\n", @status=404>
@levicole
levicole / gist:114967
Created May 20, 2009 17:31
twillio api
# be sure to gem install httparty, its a GREAT gem for
# working with these types of RESTful This is just a starting point.
# You will probably want to add a few more methods to the class that
# sets the account_sid, and account_token.
require "httparty"
class TwilioCall
include HTTParty
base_uri "https://api.twilio.com/"
#this is just your account credentials, replace them with your credentials
basic_auth ACCOUNT_SID, ACCOUNT_TOKEN
Factory.define :hot_model do |f|
f.sequence(:unique_attr) {|i| "heidi_klum#{i}" }
end
require 'rubygems'
require 'json'
require 'mash'
file = File.read("./widget.json")
mash = Mash.new(JSON.parse(file))
mash.tracks.each do |track|
`curl #{track.stream_url} > "~/immi/#{track.permalink}"`
end
def hexlify(msg)
msg.split("").collect { |c| c[0].to_s(16) }.join
end
def unhexlify(msg)
msg.scan(/../).collect { |c| c.to_i(16).chr }.join
end
puts hexlify("Hello World")