Skip to content

Instantly share code, notes, and snippets.

View morenoh149's full-sized avatar
💭
Working from 🛰

Harry Moreno morenoh149

💭
Working from 🛰
View GitHub Profile
@th3hunt
th3hunt / teaspoon.rb
Last active August 18, 2016 00:41
A teaspoon boot loader that works with browserify rails
# config/initializers/teaspoon.rb
module Teaspoon
module BootHelper
def create_browserify_bundle(suite)
bundle = File.join(Rails.root, 'tmp/javascripts', "suites/#{suite.name}.js")
bundle_dir = File.dirname(bundle)
FileUtils.mkdir_p(bundle_dir) unless File.directory?(bundle_dir)
specs = suite.spec_assets(false).map { |asset| "#{asset.gsub(/\.js.*$/, '')}" }
/* global Application, ObjC, $ */
/**
* repozish.js
*
* this is an example of using os x yosemite's "JavaScript for Automation":
*
* https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html
*
* it repositions some windows based on some position settings. you can run
@spoike
spoike / reflux.js
Created June 29, 2014 22:23
A simpler implementation of React.JS's Flux
var EventEmitter = require('events').EventEmitter,
_ = require('lodash');
/**
* Creates an action functor object
*/
exports.createAction = function() {
var action = new EventEmitter(),
eventLabel = "action",
@staltz
staltz / introrx.md
Last active June 7, 2024 23:39
The introduction to Reactive Programming you've been missing
@Kuirak
Kuirak / client
Last active August 29, 2015 14:00
$sailsSocket.subscribe('event',function(message){
if(message.verb ==='created'){
$scope.events.push(message.data);
}
});
$sailsSocket.get('/api/event/subscribe').success(function(data){
console.log("Subscribed")
});
$sailsSocket.get('/api/event').success(function(data){
$scope.events =data;
@mlynch
mlynch / directive.js
Created April 18, 2014 21:02
Starter directive
angular.module('myApp.directives', [])
.directive('myCanvas', function() {
return {
// Angular needs to know what type of usage we want to allow for this (attribute, class name, or tag).
// For this example, a tag is great.
restrict: 'E',
// We want to replace the original custom tag with a template
replace: true,
@Nagyman
Nagyman / workflows-in-django.md
Last active June 9, 2024 05:44
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@JedWatson
JedWatson / keystone.js
Created February 24, 2014 16:00
Example of how to integrate node-i18n with a KeystoneJS app (using yo keystone generated site as a basis) - see https://github.com/mashpie/i18n-node for more docs.
// Simulate config options from your production environment by
// customising the .env file in your project's root folder.
require('dotenv')().load();
// Require keystone and i18n
var keystone = require('keystone'),
i18n= require('i18n');
// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
@debasishg
debasishg / gist:8172796
Last active May 10, 2024 13:37
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@robulouski
robulouski / gmail_imap_example.py
Last active April 19, 2024 02:27
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib