Skip to content

Instantly share code, notes, and snippets.

Avatar

Eirik L. Vullum eiriklv

View GitHub Profile
@DarcInc
DarcInc / gist:9641557
Created Mar 19, 2014
Node AMQ Message Producer
View gist:9641557
var queueName = 'tasks';
var exchangeName = 'taskExchange';
var key = 'all';
var amq = require('amq');
var readline = require('readline');
var connection = amq.createConnection(
{ host: 'localhost', debug: true },
{ reconnect: { strategy: 'constant', initial: 1000 } }
@DarcInc
DarcInc / gist:9641582
Last active Aug 29, 2015
Node AMQ Message Consumer
View gist:9641582
var queueName = 'tasks';
var amq = require('amq');
var connection = amq.createConnection(
{ host: 'localhost', debug: true },
{ reconnect: { strategy: 'constant', initial: 1000 } }
);
var queue = connection.queue(queueName, { durable: true });
View gist:9728460
// browserify
var browserify = require('browserify');
var es6ify = require('es6ify');
// gulp stuff
var gulp = require('gulp');
var livereload = require('gulp-livereload');
var source = require('vinyl-source-stream');
var jshint = require('gulp-jshint');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
View castealer.rb
require 'rubygems'
require 'openssl'
require 'digest/md5'
key = OpenSSL::PKey::RSA.new(2048)
cipher = OpenSSL::Cipher::AES.new(256, :CBC)
ctx = OpenSSL::SSL::SSLContext.new
puts "Spoof must be in DER format and saved as root.cer"
raw = File.read "root.cer"
cert = OpenSSL::X509::Certificate.new raw
cert.version = 2
@brigand
brigand / index.html
Created May 1, 2014
React Drag and Drop
View index.html
<div id="main"/>
<script type="text/jsx">
/** @jsx React.DOM */
var DragItem = React.createClass({
drag: function(ev) {
ev.dataTransfer.setData("draggedItem", JSON.stringify(this.props.item));
},
render: function () {
return (<div draggable="true" onDragStart={this.drag} className="item">{this.props.item.text}</div>);
}
@soyuka
soyuka / global.js
Last active Aug 29, 2015
Opinion about global wrappers in nodejs
View global.js
//global variable
test = 'hello';
//is exactly the same as
global.test = 'hello';
//local variable - this will definitly override your global variable
var test = 'hello';
//using the process scope, if, and really if, you can't do without a global variable
View storeListenerMixin.es6.js
var StoreListenerMixin = function(...stores) {
var StoreMixin = {
getInitialState() {
return this.getStateFromStores(this.props);
},
componentDidMount() {
stores.forEach(store => store.addChangeListener(this.handleStoresChanged));
this.setState(this.getStateFromStores(this.props));
@simenbrekken
simenbrekken / README.md
Last active Aug 29, 2015
React in the Real World
View README.md
@aelaguiz
aelaguiz / CratejoyIsHiring.js
Last active Aug 29, 2015
Cratejoy (YC S13) - Hiring a killer JS Front-End Engineer to build v4 of our website builder
View CratejoyIsHiring.js
// CratejoyIsHiring.js
define(['backbone', 'underscore'], function(Backbone, _) {
var CratejoyJavascriptJob = {
needs: {
'Rebuild our website builder': {
description: 'Website builder is on v3, you\'ll build v4',
requirements: [
'Easy to use for non-technical people',
'Powerful enough for design agencies',
View gist:058845a355369ed0830f
var React = require('react');
var Ridiculous = React.createClass({
getInitialState () {
console.log(this.props.name, 'getInitialState');
return { foo: true };
},
render () {
console.log(this.props.name, 'render');