Skip to content

Instantly share code, notes, and snippets.

@rlivsey
rlivsey / test_channel.ex
Last active July 22, 2016 10:30
Subscribing to events from a Phoenix.Channel in 1.2.0-rc.0
defmodule MyApp.TestChannel do
use MyApp.Web, :channel
require Logger
intercept ["some-event"]
def join("test:lobby", _, socket) do
# subscribe to a topic
subscribe socket, "some-topic"
@bguiz
bguiz / add-broccoli-compass-to-ember-cli-app.md
Last active August 29, 2015 14:02
How to add broccoli-compass to an ember-cli app

Run the following commands:

gem install --pre compass sass-css-importer
npm install --save-dev broccoli-static-compiler broccoli-merge-trees broccoli-compass

(This assumes that you already have Ruby and NodeJs installed)

Then add the contents of snippet-add-broccoli-compass-to-ember-cli-app.js to your Brocfile.js,

@bhurlow
bhurlow / proxy.js
Created May 7, 2013 19:12
minimalistic node http proxy
var http = require('http');
var url = require('url');
var path = require('path');
var request = require('request');
var ports = {
"localhost": 3100,
"dev.localhost": 3200
}
@ncolgan
ncolgan / gist:4323483
Created December 17, 2012 23:38
Singleton resources in ember.js
App.Store = DS.Store.extend({
revision: 10,
adapter: DS.RESTAdapter.extend({
bulkCommit: false,
find: function(store, type, id) {
if (id === 'singleton') {
var url = '/' + this.rootForType(type);
$.getJSON(url, function(data) {
data.id = id;
store.load(type, id, data);
@dre1080
dre1080 / .powenv
Last active March 21, 2018 14:06
Using Pow!! with Foreman (Configuration)
# In your app's root.
# Make Pow!! export all the env variables contained in the .env file used by Foreman.
export $(cat .env)
@mraaroncruz
mraaroncruz / description.md
Created October 8, 2012 09:45
granadajs Hacknight Uno

Granadajs Hacknight Uno

Ideas for app

  • Shopping - a shopping list app, maybe with phonegap. Web/phone sync.
  • Tapatracker - categorize, describe, photos?, location tapa tracker. "Do I want asian noodles or oxtail? I'll check tapatracker!"
  • Unlikeable - a facebook app that checks which of your friends liked things that you disliked. I don't know if this is possible. It probably is.
  • SoundCloud playlist creator
@ndbroadbent
ndbroadbent / deploy.rake
Created September 28, 2012 22:18
Rake task for precompiling assets locally before deploying to Heroku
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"
@ivarvong
ivarvong / gist:3763494
Created September 21, 2012 19:48
Mixpanel Data Export API hack for Node.JS
// this is for node.js. putting your api_secret in a web browser is not ideal.
var crypto = require('crypto');
var md5sum = crypto.createHash('md5');
var request = require('request');
var api_key = 'your_api_key_here';
var api_secret = 'your_api_secret_here';
var api_endpoint = 'http://mixpanel.com/api/2.0/';
@lfborjas
lfborjas / gist:817504
Created February 8, 2011 23:12
Filter even numbers in a list; fork it for maximum fun!
#these are meant to be run in a REPL, and the java one in beanshell of something of the sort:
#ruby
[1,2,3,4].select{ |x| x.even? }
#python
[x for x in [1,2,3,4] if not x%2]
#or, more norvingly
filter(lambda x: not x%2, [1,2,3,4])
#clojure