Skip to content

Instantly share code, notes, and snippets.

View yanatan16's full-sized avatar

Jon Eisen yanatan16

View GitHub Profile
@yanatan16
yanatan16 / BasketballGame.hs
Last active December 31, 2015 06:09
Hackercup basketball game
-- Competitions
import Data.Competition
-- List operations
import Data.List
------------------------
-- Type Instance
------------------------
@yanatan16
yanatan16 / golang-gvm.sls
Last active December 30, 2015 07:39
Salt states for golang / gvm
{% set goversion = 'go1.2' %}
gvm:
cmd.run:
- name: bash < <(curl -s https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
- user: deploy
- require:
- user: deploy
go1.2:
@yanatan16
yanatan16 / create.cypher
Last active December 25, 2015 08:19
Simple neo4j recommendation engine
CREATE (u:User { user })-[:BUYS]->(p:Product { product }) RETURN u, p;
@yanatan16
yanatan16 / recommender.md
Last active December 25, 2015 00:38
A simple neo4j based recommendations engine

Recommendations Engine in neo4j

Node Types

  • Project: { type: "project", id: <id>, featured: <bool> }
  • User: { type: "user", id: <id> }
  • Tag: { type: "tag", name: <name> }

Relationships

@yanatan16
yanatan16 / pipe_to_s3.js
Created October 8, 2013 14:55
Pipe uploads to S3 with node.js and express
var express = require('express')
, knox = require('knox')
var bucket = 'your-bucket'
, s3 = knox.createClient({
secure: true,
bucket: bucket,
key: your_key,
secret: your_secret
})
@yanatan16
yanatan16 / get_recurring_to_exec.lua
Last active April 19, 2017 21:03
recurring tasks in relyq/qb lua scripts
-- KEYS:[zset], ARGV:[now]
-- the sorted set contains key / next pairs, where next is the next execution time
-- Find all upcoming tasks
-- Get their intervals and requeue them
local refs = redis.call("zrangebyscore", KEYS[1], 0, ARGV[1])
for i,ref in pairs(refs) do
tref, int = string.match(ref, "([^|]*)|(\d+)")
redis.call("zincrby", KEYS[1], int, tref)
refs[i] = tref
@yanatan16
yanatan16 / A-Pen-by-Jon-Eisen.markdown
Last active June 15, 2019 02:17
Spotlight and shadow effects in all css/javascript.
@yanatan16
yanatan16 / Gruntfile.js
Created September 11, 2013 23:08
Grunt System to build angular projects
module.exports = function ( grunt ) {
/**
* Load required Grunt tasks. These are installed based on the versions listed
* in `package.json` when you do `npm install` in this directory.
*/
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
@yanatan16
yanatan16 / .mongorc.js
Last active June 27, 2022 09:03
My .mongorc.js file
(function () {
rcversion = '1.0';
load('underscore.min.js')
// NOTES
// Basics, wrap the whole thing in a function
// Set a version for sanity's sake
// Load underscore, a must in any javascript environment
@yanatan16
yanatan16 / pullreq.sh
Last active January 11, 2020 22:53
pullreq - A bash function to make a pull request.
# Push your current branch to origin and open a pull request to upstream:$1 or upstream:master
pullreq()
{
local browser=google-chrome # replace with your browser command
local regex='(https?://|git://|git@)([a-zA-Z0-9\.]+)[:/]([a-zA-Z0-9]+)/(.+)?'
local origin=$(git remote -v | grep origin | grep push | cut -f2 | cut -d' ' -f1)
local upstream=$(git remote -v | grep upstream | grep fetch | cut -f2 | cut -d' ' -f1)
local params=$(python -c "import sys;import re;print ':'.join(re.match('${regex}',sys.argv[1]).groups()[1:])" $origin)
local site=$(echo $params | cut -d':' -f1)