Skip to content

Instantly share code, notes, and snippets.

View EliCDavis's full-sized avatar
👹
In another reality

Eli Davis EliCDavis

👹
In another reality
View GitHub Profile
@sirbarrence
sirbarrence / rxDecorateDirective.js
Last active September 6, 2016 10:29
A function to decorate some stock AngularJS 1.x directives to accept RxJS Observables. Finished product of https://barrysimpson.net/posts/rx-directive-decorators and https://barrysimpson.net/posts/rx-directive-decorators-update1
'use strict';
function rxDecorateDirective($provide, directiveName) {
// Duck-typing function lifted from the rx.js source.
function isObservable(obj) {
return obj && typeof obj.subscribe === 'function';
}
$provide.decorator(directiveName + 'Directive', ['$delegate', 'rx', function($delegate, rx) {
var directiveConfig = $delegate[0];
@Sigmus
Sigmus / gulpfile.js
Last active November 15, 2017 11:55
gulpfile.js with browserify, reactify, watchify and gulp-notify.
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';
@kalebpace
kalebpace / screenshot.sh
Created April 13, 2018 06:42
Screenshot script that can be mapped to a shortcut. Rectangle select and copies straight to clipboard.
#!/bin/bash
PIC=~/Pictures/temp.png
sleep 0.2; scrot -s $PIC
xclip -selection clipboard -t image/png -i < $PIC
rm $PIC
W = 500
H = 585
W1 = W - 1
H1 = H - 1
def setup
@img = load_image '../scratch/girl.png'
@img.filter BLUR, 3
@img.load_pixels
end
@jiffyclub
jiffyclub / tserv
Last active September 3, 2020 09:14
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,
@jhnns
jhnns / git-pr
Last active March 15, 2021 07:50
Git custom command to quickly checkout pull-requests from different origins as described in https://help.github.com/articles/checking-out-pull-requests-locally. Place this file somewhere in your path and git will run it everytime you type `git pr ...`
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: git pr [clean] [<remote>] <id-or-url>"
echo ""
echo "Examples:"
echo "git pr 42 --> git fetch origin pull/42/head:pr/origin/42"
echo "git pr upstream 42 --> git fetch upstream pull/42/head:pr/upstream/42"
echo "git pr https://github.com/peerigon/phridge/pull/1 --> git fetch https://github.com/peerigon/phridge.git pull/1/head:pr/peerigon/phridge/1"
echo "git pr clean --> Deletes all branches that match pr/*/* and pr/*/*/*"
@akheron
akheron / smtpd_fixture.py
Last active June 30, 2021 10:26
SMTP server pytest fixture
# The SMTP server runs in a separate thread and stores sent messages in a list
#
# Usage:
#
# def test_fn(smtpd):
# host = smtpd.host
# port = smtpd.port
#
# # Run code that send email using an smtp server at host:port
#
@aceslowman
aceslowman / CapsuleGeometry.js
Last active January 2, 2022 11:08
Capsule Geometry for ThreeJS
import * as THREE from "three";
/*
Implemented from a technique described here:
http://paulbourke.net/geometry/capsule/
PID2 taken from Paul Bourke's paulslib.h
PID2 = 1.570796326794896619231322;
ISSUES:
@hawkins
hawkins / git-php-webhook.php
Last active April 25, 2022 13:30 — forked from marcelosomers/git-php-webhook.php
A basic webhook for deploying updates to repos on Github to your local server
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
@yyscamper
yyscamper / parseFloat.go
Created August 2, 2017 06:59
An advance ParseFloat for golang, support scientific notation, comma separated number
package main
import (
"fmt"
"math"
"strconv"
"strings"
)
func ParseFloat(str string) (float64, error) {