Skip to content

Instantly share code, notes, and snippets.

View scottmessinger's full-sized avatar

Scott Ames-Messinger scottmessinger

View GitHub Profile
@pichfl
pichfl / example.hbs
Last active October 4, 2022 19:01
Media query helper for Ember.js
{{#if (match-media "(max-width:800px)")}}
MediaQuery matches
{{ else}}
MediaQuery doesn't match
{{/if}}
@konklone
konklone / Dockerfile
Created September 22, 2013 18:17
Dockerfile for installing Ruby 2.0 and RVM
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
// 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
@krisselden
krisselden / webpack.config.js
Last active March 31, 2021 03:14
Embroider App Webpack Dev Server Config
/* eslint-env node */
const { Webpack } = require("@embroider/webpack");
const variant = {
name: "dev",
runtime: "browser",
optimizeForProduction: false,
};
const webpack = new Webpack(
__dirname,
__dirname + "/dist",
@lifeart
lifeart / StateManager.js
Last active March 19, 2021 07:19
state manager, based on ember-concurrency
import {
timeout,
task
} from 'ember-concurrency';
export class StateManager {
constructor() {
this.startExecution();
}
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
require 'date'
class FirebasePush
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def initialize
@prev_ts = 0
@rand_chars = Array.new(12)
end
@developit
developit / hydra-alias.md
Last active February 27, 2020 01:54
Alias to invoke Chrome Canary w/ tracing, for IRHydra

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:

@machty
machty / document-title-router.js
Created January 14, 2014 05:12
document.title integration in ember
// 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,
@code0100fun
code0100fun / tests_acceptance_foo-test.js
Last active July 9, 2018 01:05
Ember CLI QUnit text content helpers
// 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">]