This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'node-rules' { | |
export default class RuleEngine { | |
constructor(rules?: Rule[] | Rule, options?: object); | |
register(rule: Rule): any; | |
sync(): Rule[] | void; | |
execute(fact: {[x: string]: any}, cb: (data: {result?: any, reason?: any, [x: string]: any}) => void): void; | |
findRules(filter?: any): Rule[] | void; | |
turn(state: string, filter: any): Rule[] | void; | |
prioritize(priority: number, filter: any): Rule[] | void; | |
toJSON(): string; |
This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).
Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.
Switch to the master branch and make sure you are up to date:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defimpl Enumerable, for: Tuple do | |
def count(tuple) do | |
tuple_size(tuple) | |
end | |
def member?([], _), do {:ok, false} | |
def member?({}, _), do {:ok, false} | |
def member?(tuple, elem) do | |
tuple | |
|> Tuple.to_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from pymongo import MongoClient | |
import json | |
def mongoimport(csv_path, db_name, coll_name, db_url='localhost', db_port=27000) | |
""" Imports a csv file at path csv_name to a mongo colection | |
returns: count of the documants in the new collection | |
""" | |
client = MongoClient(db_url, db_port) | |
db = client[db_name] |
I hereby claim:
- I am jxub on github.
- I am jxub (https://keybase.io/jxub) on keybase.
- I have a public key ASC0COBt6HSAbVQUBqTHEWBgAg33-HW_bGa0-73LBnuuswo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "bytes" | |
func StreamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
func StreamToString(stream io.Reader) string { | |
buf := new(bytes.Buffer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// functional is a small FP-like library with no dependencies (yet!) | |
// open-sourcing bits and pieces here on gist :) | |
package bitbucket.com/jjanarek/x/functional | |
// Reduce reduces a slice of ints, uints or runes to a single element | |
// making the pythonic lambda sadly implicit and opinionated | |
func Reduce(elements []interface{}) interface{} { | |
switch elements.(type) { | |
case int: |
NewerOlder