Skip to content

Instantly share code, notes, and snippets.

Sean Rucker seanrucker

Block or report user

Report or block seanrucker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pyrtsa
pyrtsa / AnyEquatable.swift
Created May 25, 2016
AnyEquatable—making Equatable work with class inheritance and existential wrapping ("type erasure")
View AnyEquatable.swift
// Toggle this boolean to compare against stdlib:
#if true // Stdlib version
// Quick hack to avoid changing the AnyEquatable implementation below.
extension Equatable { typealias EqualSelf = Self }
#else // Modified version
protocol Equatable {
View sanfrancisco-font.css
/** WARNING - USE AT OWN RISK */
/** IT IS AGAINST APPLE'S POLICY TO USE SF PRO FOR ANYTHING OTHER THAN iOS/tvOS/macOS/watchOS DESIGN & DEVELOPMENT */
/** https://sf.abarba.me/font.css */
/** https://sf.abarba.me/LICENSE.pdf */
/** 1. Copy/import this file into your main css/scss file */
/** 2. Change css font-family: to "SF Text", "SF Display" or "SF Mono" */
/** 3. Apply font-weight or italic to html elements */
/** THANK YOU */
@hueniverse
hueniverse / gist:a06f6315ea736ed1b46d
Last active May 7, 2019
Simple node.js code style tips to improve code quality
View gist:a06f6315ea736ed1b46d

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

@slindberg
slindberg / ember-data.dependent-relations.js
Last active Mar 7, 2016
Dependent Relationships in Ember Data
View ember-data.dependent-relations.js
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@Marsup
Marsup / reverse.js
Created Oct 31, 2013
Hapi reverse proxy
View reverse.js
var Hapi = require('hapi');
var server = new Hapi.Server('0.0.0.0', 3000);
server.route({
method: '*',
path: '/{path*}',
handler: {
proxy: {
host: 'amazon.com',
@chrisyour
chrisyour / Remove Textmate 2 Cache
Created Jul 29, 2013
If your bundles start acting funny and aren't loading properly, you can always remove TextMate's cache and start again. For example, the basic HTML indenting features in Textmate 2 suddenly vanished on me along with some other HTML commands I use everyday. I removed the cache folder and restarted Textmate 2 and everything was back to normal.
View Remove Textmate 2 Cache
rm -rf ~/Library/Application\ Support/TextMate/Cache/*
@machty
machty / new-router-examples.md
Last active May 2, 2018
How to do cool stuff with the new Router API
@machty
machty / router.md
Last active Dec 16, 2015
The smallest possible router refinement.
View router.md

Proposal

  1. No longer encourage/allow external calls to a Route's transitionTo method.
  2. Instead, make use of a new routeTo event, with the same semantics as transitionTo, only that it's an event that routes can respond to.
  3. ApplicationRoute will have a default routeTo handler which passes its args to an internal transitionTo.
  4. URL changes will be converted into a routeTo event event.
@dmonagle
dmonagle / ember_crud.coffee
Last active Dec 12, 2015
Ember mixins for CRUD functionality.
View ember_crud.coffee
Ember.EditController = Ember.Mixin.create(
saveError: false
saveInvalid: false
isEditing: false
# Set associations to be associations of the content. These will then be checked for validity on save
# and all of the flags, such as isDirty and isLoaded, will take these associations into consideration.
#
# Eg: A user may have an address model which is edited within the same transaction.
# In this case you would put:
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active Apr 19, 2019
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
View KeychainItemWrapper.h
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
You can’t perform that action at this time.