Skip to content

Instantly share code, notes, and snippets.

@anewusername1
anewusername1 / publisher.rb
Created August 17, 2011 15:24
Multicast pub/sub using rabbitmq, amqp, and bunny
require 'bunny'
b_con = Bunny.new(host: 'localhost', port: 5672, logging: true)
b_con.start
b_q = b_con.queue('events')
b_ex = b_con.exchange('events', type: :topic)
b_ex.publish('message!!', key: 'usermanager.user.login')
@xdite
xdite / gist:3072362
Created July 8, 2012 19:10
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \
@barnes7td
barnes7td / sublime_setup.md
Last active March 28, 2024 17:59
Sublime Terminal Setup

Setup Terminal for Sublime Shorcut "subl":

Open terminal and type:

1. Create a directory at ~/bin:

mkdir ~/bin

2. Copy sublime executable to your ~/bin directory:

@lightyrs
lightyrs / Custom.css
Created December 17, 2012 08:26
My Chrome Dev Tools Skin incorporates the sleek visual style of codepen.io with some of my own usability enhancements. Pictured here with Monokai color scheme ( http://imgur.com/mbrqt ).
/*
Chrome Developer Tools - Monokai Color Theme
Author: Béres Máté Csaba / bjmatt.com / @bjmatt / beres.mate@bjmatt.com
-----------------------------------------------------------------------------------------------------------
Installation:
1. Find your Chrome's user stylesheets directory:
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@mbostock
mbostock / .block
Last active December 6, 2016 07:14
Graph Rollup
license: gpl-3.0
@mminer
mminer / jsonhandler.py
Created April 26, 2013 02:36
A JSON request handler for Tornado.
import json
import tornado.web
class JsonHandler(BaseHandler):
"""Request handler where requests and responses speak JSON."""
def prepare(self):
# Incorporate request JSON into arguments dictionary.
if self.request.body:
try:
@katowulf
katowulf / 1_using_queries.js
Last active April 24, 2023 07:14
Methods to search for user accounts by email address in Firebase
/***************************************************
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
***************************************************/
var fb = firebase.database.ref();
/**
* @param {string} emailAddress
@nisaacson
nisaacson / README.md
Last active December 9, 2019 01:17
Vim Javascript indentation via esformatter. Idea insired by http://yieldthedog.github.io/blog/2013/03/01/invoke-js-beautify-in-vim/
@Spudz76
Spudz76 / WebStorm-Cygwin-HOWTO.md
Last active February 18, 2024 13:23
Set up Windows Powershell to use cygwin where possible and optionally autolaunch bash when it starts up

#WebStorm Cygwin with "PowerBash" Begin with the guide by @nullivex here for general installation. NOTE: This is all with 32-bit stuff even on x64 platform. Cygwin32, and WebStorm and Node.js etc all set up 32-bit. You may skip the Git parts of that guide, and instead install Cygwin and the git and openssh it contains. Otherwise, you must NOT set up git in Cygwin so that the Native Git is found. But, that would sort of negate most of the gains herein. If you already use Cygwin and its git and have openssh keys all set up for Github and etc, this is a way to keep one set of configurations, and a familiar shell.

This will set up WebStorm to use Cygwin versions of everything except for:

  • Node.js (because there is no Cygwin version currently)
  • Python (because some of the Node.js/npm thin