This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.pusher_async = (pusher_or_key, callback)-> | |
return _(pusher_async).delay 22, key unless Pusher? | |
callback if typeof pusher_or_key is 'string' then new Pusher pusher_or_key else pusher_or_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Notification | |
extend ActiveSupport::Concern | |
included do | |
after_create { notify 'created' } | |
after_update { notify 'updated' } | |
after_destroy { notify 'destroyed' } | |
class << self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... somewhere in your Backbone app init function, after initialising the "@things" collection: | |
pusher_async pusher_or_key, (pusher)=> | |
pusher.connection.bind 'connected', => @things.fetch() | |
new Backpusher pusher.subscribe(channel), @things | |
# ... where channel's value is being rendered in the caller template like this: | |
"#{ENV['FAKE_PUSHER']? PusherFake.javascript : Pusher.key.to_json}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- if defined? PusherFake | |
= javascript_tag File.read Dir.glob(File.expand_path 'features/support/application/public/javascripts/vendor/pusher-2.*.js', Bundler.load.specs.find{|s| s.name == 'pusher-fake' }.full_gem_path).last | |
- else # NOTE Since Pusher is not really useful with no internet connection... let's CDN it | |
%script{:src => "http://js.pusher.com/2.0/pusher.min.js", :defer => true} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#= require mockfirebase/browser/mockfirebase | |
MockFirebase.override() | |
class TrueMockFirebase extends Firebase | |
constructor: (path)-> | |
super | |
_(=> | |
if window.MOCK_FIREBASE && MOCK_FIREBASE[path] | |
@set(MOCK_FIREBASE[path]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE source this file from $HOME/.bashrc | |
# NOTE and have a .dockerrc — e.g. containing "eval $(docker-machine env default)" — in your project directory | |
_before_dmm_docker() { command docker "$@"; } | |
OLD_DOCKER_FUNC="`declare -f docker`" | |
if [ -n "$OLD_DOCKER_FUNC" ] | |
then eval "_before_dmm_$OLD_DOCKER_FUNC" | |
fi | |
docker() { | |
local OLD_IFS="$IFS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* eslint-disable no-console */ | |
var TEST_DELAY = 0; | |
var TEST_SIZE = 1000; | |
console.log('TO-Starting ' + TEST_SIZE); | |
var tos = Array.apply(null, Array(TEST_SIZE)).map(function startTimeout() { | |
return setTimeout(function stopAllTimeouts() { | |
try { | |
console.log('TO-Stopping ' + tos.length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.ignore_match(pattern, path) | |
path = '/' + path unless path =~ %r'^/' | |
if File.directory?(path) | |
path += '/' unless path =~ %r'/$' | |
end | |
if pattern.is_a?(Array) | |
pattern | |
else | |
[pattern] | |
end.any? do |pattern| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev() { | |
local machine_name | |
local dir_name | |
local proj_name | |
local host | |
local host_user | |
local host_path | |
local ssh_cmd | |
if ! dev-setup | |
then return $? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "postfix postfix/mailname string ido-dev.bandmanage.com" | debconf-set-selections | |
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections | |
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postfix libsasl2-modules || exit 2 | |
grep -vE 'default_transport = error|relay_transport = error' /etc/postfix/main.cf > /tmp/main.cf | |
cat /tmp/main.cf > /etc/postfix/main.cf | |
echo ' | |
relayhost = [smtp.sendgrid.net]:2525 | |
smtp_tls_security_level = encrypt | |
smtp_sasl_auth_enable = yes |