Skip to content

Instantly share code, notes, and snippets.

Scott Ames-Messinger scottmessinger

Block or report user

Report or block scottmessinger

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
View hashlist.js
// UPDATE: don't use this. when it re-partitions the list when time moves forward, it does not correctly keep hashes
// Use a real merkle tree instead: https://gist.github.com/jlongster/f431b6d75ef29c1a2ed000715aef9c8c
import Timestamp from './timestamp';
// This is a compact data structure that keeps track of a list of
// hashes (representing messages) over a range of time in order to
// figure out what has changed between clients, kinda like a Merkle
// tree. It creates "buckets" that represent different time ranges,
// and divides time into smaller buckets the more recent they are. The
@developit
developit / hydra-alias.md
Last active Oct 27, 2018
Alias to invoke Chrome Canary w/ tracing, for IRHydra
View hydra-alias.md

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome:

@code0100fun
code0100fun / tests_acceptance_foo-test.js
Last active Jul 9, 2018
Ember CLI QUnit text content helpers
View tests_acceptance_foo-test.js
// tests/acceptance/foo-test.js
// Assert that text should be found
assert.hasText('Not Found'); // Error: Could not find text "Not Found" on the page
// Provide custom message
assert.hasText('Not Found', 'Expected to find "Not Found"'); // Error: Expected to find "Not Found"
// Find any number of elements containing the query text
text('Found'); // [<div>Found</div>, <input value="Found">]
View FirebasePush.rb
require 'date'
class FirebasePush
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def initialize
@prev_ts = 0
@rand_chars = Array.new(12)
end
@mikelehen
mikelehen / generate-pushid.js
Created Feb 11, 2015
JavaScript code for generating Firebase Push IDs
View generate-pushid.js
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
View dot_notation.rb
# Simple-ish enumberable-simplifier. Useful for APIs like Twitter, etc
#
# If you have a hash or an array or something that quacks like one, you can do stuff
# example:
# h = {a: {b: {c: [{d: 'hi'}]}}}
# h.extend(DotNotation)
# h.dot('a.b.c.0.d')
# #=> 'hi'
# h.dot('a.b.c.foo.bar.bz.whatever.124.whocares')
# #=> nil
@machty
machty / document-title-router.js
Created Jan 14, 2014
document.title integration in ember
View document-title-router.js
// Extend Ember.Route to add support for sensible
// document.title integration.
Ember.Route.reopen({
// `titleToken` can either be a static string or a function
// that accepts a model object and returns a string (or array
// of strings if there are multiple tokens).
titleToken: null,
@mmun
mmun / groupBy.js
Last active Dec 31, 2015
Computed groupBy
View groupBy.js
(function() {
var get = Ember.get, set = Ember.set;
function findItemInsertionIndex(group, changeMeta, instanceMeta) {
for (var i = get(group, 'length') - 1; i >= 0; i--) {
var currentItem = group.objectAt(i),
currentIndex = instanceMeta.itemGuidToIndex[Ember.guidFor(currentItem)];
if (currentIndex < changeMeta.index) {
return i + 1;
@konklone
konklone / Dockerfile
Created Sep 22, 2013
Dockerfile for installing Ruby 2.0 and RVM
View Dockerfile
FROM ubuntu
MAINTAINER Eric Mill "eric@konklone.com"
# turn on universe packages
RUN echo "deb http://archive.ubuntu.com/ubuntu raring main universe" > /etc/apt/sources.list
RUN apt-get update
# basics
RUN apt-get install -y nginx openssh-server git-core openssh-client curl
RUN apt-get install -y nano
@lukemelia
lukemelia / buffered_proxy.js
Last active May 5, 2016
Buffered Proxy, extracted from Yapp codebase
View buffered_proxy.js
var empty, get, set,
__hasProp = {}.hasOwnProperty;
get = Ember.get;
set = Ember.set;
empty = function(obj) {
var key;
for (key in obj) {
if (!__hasProp.call(obj, key)) continue;
You can’t perform that action at this time.