Skip to content

Instantly share code, notes, and snippets.

View snuggs's full-sized avatar
👤
Committing

Ahmid-Ra snuggs

👤
Committing
View GitHub Profile
module Arel
class TwitterArray
include Relation
attr_reader :array, :attribute_names_and_types
include Recursion::BaseCase
ATTR_MAP = {
:twitter_name => Attributes::String,
:id => Attributes::Integer,
# (T) - Twitter Updates
# id = Arel::Attributes::Integer.new nil, :id
# update = Arel::Attributes::String.new nil, :update
# tuples = [[1, "Hai I can haz cheezburgerz"], [2, "Nom!"], [0, "What can you haz?"]]
# headers = [Arel::Attributes::Integer.new(nil, :id), Arel::Attributes::String.new(nil, :update)]
# updates = Arel::Array.new tuples, headers
# find_twitter_user_updates_predicate = Arel::Predicates::Equality.new updates[:id], 9
@charissa
charissa / bicycle.rb
Created March 10, 2011 15:31
Bicycle2 refactors Bicycle
#!/opt/local/bin/ruby1.9
include Math
class Bicycle
attr_accessor :wheel_size, :chainring, :cassette, :name
# Create the object
def initialize(name = "A Bicycle",wheel_size=27,chainring=42,cassette=[28,24,21,18,16,14,12,11])
@name = name
@wheel_size=wheel_size
@travis
travis / gist:1084767
Created July 15, 2011 14:16
testing facebook connect with capybara and rspec
require 'mogli'
module FacebookIntegrationHelpers
shared_context "with unconnected facebook user" do
let(:fb_user) { create_test_user(installed: false) }
after { fb_user.destroy }
end
def app_client
Mogli::AppClient.new(AppConfig.facebook.access_token, AppConfig.facebook.app_id)
@TakayoshiKochi
TakayoshiKochi / html-modules-issue645.md
Last active March 27, 2019 04:45
Summary of HTML Modules discussion

HTML Modules summary (issue#645)

Initial: Jun. 28, 2017 / Last Update: Aug. 14, 2017

What is this?

This is the summary of the discussion happening for HTML Modules at webcoomponents#645.

There appear to be lots of diverse opinions, and I'll try to capture them, summarize and provide here for catching up with the discussion for all. Note that this document should never be considered official, complete or final. If anything is wrong or lost, please let @TakayoshiKochi know.

@dyba
dyba / application.html.haml
Created November 1, 2011 02:35
Jasmine YML file
!!! 5
%html
%head
%title TESTAPP
= stylesheet_link_tag "application"
= javascript_include_tag "application", "registration"
= csrf_meta_tag
%body
%header
%h1#logo
class User
attr_reader :item
def self.create(name)
User.new(TABLES['users'].items.create(id: name))
end
def self.all
TABLES['users'].items.to_a.map{|i| User.new(i)}
end
@cmoulton
cmoulton / UISwiftRestDemo
Last active September 9, 2021 21:01
Quick & dirty REST API calls with Swift 2.2. See http://grokswift.com/simple-rest-with-swift/
// MARK: Using NSURLSession
// Get first todo item
let todoEndpoint: String = "http://jsonplaceholder.typicode.com/todos/1"
guard let url = NSURL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = NSURLRequest(URL: url)
@chrisjacob
chrisjacob / README.md
Created July 5, 2011 12:32
ViewSource.me - Starting a new viewsource.me.PROJECT repository.

Global .gitignore

We don't want to polute the repository with a .gitignore file... so you must add common OS files to your Global .gitignore. If you don't already have a global .gitignore then follow the instructions below (from: http://help.github.com/ignore-files/) or skip to the next section.

cd ~   
touch .gitignore_global   
mate .gitignore_global   
@madrobby
madrobby / gist:9476733
Created March 10, 2014 23:34
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path