Skip to content

Instantly share code, notes, and snippets.

View michaelcontento's full-sized avatar

Michael Contento michaelcontento

View GitHub Profile
@michaelcontento
michaelcontento / index.js
Created March 4, 2016 08:24
Split state in redux-storage
import * as storage from 'redux-storage'
import filter from 'redux-storage-decorator-filter';
import { createStore, applyMiddleware } from 'redux';
// For this example I'm using a simple in-memory engine. Thus should obiously
// be repalced with something real :-)
function createEngine(name, value) {
return {
load() {
return Promise.resolve(value);
var socket = require('socket.io-client')('http://127.0.0.1:3000');
socket.on('connect', function(io){
console.log('[CLIENT] connected');
var data = { name: 'hans' };
console.log('[CLIENT] sending json:', '(' + typeof data + ')', data);
socket.emit('json', data);
var data = 'hello world';
console.log('[CLIENT] sending string:', '(' + typeof data + ')', data);
#!/usr/bin/python
# setup: pip install requests beautifulsoup4
from decimal import Decimal
import requests
from bs4 import BeautifulSoup
import sys
import getpass
buildscript {
repositories {
maven {
url('http://repository.openbakery.org/')
}
mavenCentral()
}
dependencies {
classpath "org.openbakery:xcode-plugin:0.11.+"
'use strict';
var React = require('react/addons');
var PureRenderMixin = React.addons.PureRenderMixin;
var MAX_LOADING_TASKS = 3;
var loadingQueue = [];
var loadingQueueDirty = false;
var loadingTasks = 0;
use std::fmt;
use std::num;
struct Point3 {
x: f64,
y: f64,
z: f64,
}
impl Point3 {
fn new(x: f64, y: f64, z: f64) -> Point3 {
<?php
class A
{
public function __construct()
{
$this->lambda = function() {
echo "Hello World!";
};
}
#!/usr/bin/env bash
url_svn() {
local svn_branch_url=$(git svn info | grep URL: | cut -d' ' -f2)
local svn_branch_url=${svn_branch_url/\/trunk/\/branches}
local svn_branch_url=${svn_branch_url/\/trunk\//\/branches}
local svn_branch_url=${svn_branch_url/\/branches\/*/\/branches}
echo $svn_branch_url
}
#!/usr/bin/env zsh
sed -i '' -e 's/^antigen bundle/#antigen bundle/' ~/.zshrc
tests=$(grep "#antigen bundle" ~/.zshrc | wc -l)
last_sum=0
for it in $(seq 1 $tests); do
sum=0
name=$(grep '#antigen bundle' ~/.zshrc | head -n 1 | cut -d' ' -f3)
sed -i '' -e '1,/#antigen bundle/s/#//' ~/.zshrc
from redis import from_url as redis_from_url
def create_api(app):
access_key_id = app.config["AMAZON_ACCESS_KEY"]
secret_access_key = app.config["AMAZON_SECRET_KEY"]
associate_tag = app.config["AMAZON_ASSOCIATE_TAG"]
locale = app.config["AMAZON_LOCALE"]
redis = redis_from_url(app.config["AMAZON_REDIS_URL"])