Skip to content

Instantly share code, notes, and snippets.

View DanielFGray's full-sized avatar

Daniel Gray DanielFGray

View GitHub Profile
@KittyKatt
KittyKatt / pomf
Last active March 24, 2018 14:49
pomf.se BASH script to upload images
#!/usr/bin/env bash
# pomf.se uploader
# requires: curl
dest_url='http://pomf.se/upload.php'
return_url='http://a.pomf.se'
if [[ -n "${1}" ]]; then
file="${1}"
if [ -f "${file}" ]; then
#!/usr/bin/env python
# freeleech.py originally by tobbez
# Now maintained at github.com/spaghetti2514/What.cd-Freeleech
import os
import re
import sys
import json
import time
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@dahu
dahu / gist:c38092e54ec7c6ef7132
Created February 11, 2015 02:18
Expand bash brace forms in Vim
" Barry Arthur, Feb 2015
" Expand a bash brace expression
let x = 'xorg-{,xinit,xfontsel,xset,xrdb,font-util{,s},server{,-utils,},utils,xmodmap,xwininfo}'
function! BashBracesToVimTree(string)
return eval('[' .
\ tr(substitute(substitute(substitute(substitute(a:string, "'", "''", 'g')
\ , '[^,{}]\+', "'&'", 'g')
\ , "'{", "',{", 'g')
@geuis
geuis / gist:1489bbd1a8e47e86db38
Last active April 9, 2017 08:38
Force jshint validation with pre-commit hook (bash)
#!/bin/sh
# Run changed javascript files through jshint before commiting and prevent bad
# code from being committed.
# If you need to prevent newly added js from being checked because its in a
# library like bower_components, add a .jshintignore file and list the directory
# INSTALL: Add as a file in your repo as .git/hooks/pre-commit
FILES=$(git diff --cached --name-only --diff-filter=ACM| grep ".js$")
if [ "$FILES" = "" ]; then
exit 0
@sim642
sim642 / force_nick.py
Last active August 29, 2015 14:24
force_nick: Force nick change on channels which disallow it
import weechat
import sys
import re
weechat.register("force_nick", "sim642", "0.1", "TODO", "Force nick change on channels which disallow it", "", "")
#weechat.prnt("", "Hi, this is script")
#weechat.prnt("", str(sys.version_info))
servers = {}
@joepie91
joepie91 / getting-started.md
Last active July 7, 2024 02:41
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

@Avaq
Avaq / combinators.js
Last active September 26, 2024 18:53
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@whiteinge
whiteinge / flux-with-vanilla-rx.js
Last active July 27, 2023 10:36
An example of canonical Flux using vanilla RxJS
var Actions = new Rx.Subject();
Actions.onCompleted = () => {}; // never complete
var act = (tag, data = {}) => ({tag, data});
var send = tag => data => Actions.onNext(act(tag, data));
var Dispatcher = Actions.asObservable();
// ----------------------------------------------------------------------------
var C = constants = {
GET_USER: 'get_user',
@joepie91
joepie91 / promises-faq.md
Last active June 25, 2023 09:02
The Promises FAQ - addressing the most common questions and misconceptions about Promises.