Skip to content

Instantly share code, notes, and snippets.

View snuggs's full-sized avatar
👤
Committing

Snuggs snuggs

👤
Committing
View GitHub Profile
@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.

@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)
@allenwb
allenwb / 0Option2ConstructorSummary.md
Last active November 4, 2023 14:39
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@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
@mildmojo
mildmojo / left_join_arel_example.rb
Last active April 5, 2024 16:00
LEFT JOIN in ARel for ActiveRecord in Ruby on Rails
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of
# the mechanics, not a real-world use case.
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord
# extension that works for any named association. That's what I really wanted!
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446
# == DEFINITIONS
# - A Taxi is a car for hire. A taxi has_many :passengers.
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi.
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
@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
@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)
@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   
@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