Skip to content

Instantly share code, notes, and snippets.

View andykais's full-sized avatar

Andrew Kaiser andykais

View GitHub Profile
anonymous
anonymous / gist:1e827007070614fb32e3
Created July 6, 2015 01:34
youtube thru tor ( ͡° ͜ʖ ͡°)
read DL
mkdir temp/ && cd temp
usewithtor youtube-dl $DL
DF="$(ls | grep ".mp4")"
mv $DF ../$DF && cd ../ && rm temp/
vlc $DF
@CarbonFactory
CarbonFactory / gulp-wiredep-options.js
Last active July 6, 2017 13:30
How to make gulp-wirdep pick the minified ".min" files instead of the un-minified files - ASP.net C# template
/*
* Description: How to make gulp-wirdep pick the minified ".min" files instead of the un-minified files. The template I've used for ASP.net. You can change the regex in the 'block' option to whichever you want like html or jade
* Author: Dev Anand
* Author URI: https://github.com/CarbonFactory
* License: MIT
*/
/**
* wiredep options
*/
const compose = (a, b) => x => a(b(x));
const reverse = array => [...array].reverse();
// `get` is a simple accessor function, used for selecting an item in an array.
const get = id => array => array[id];
// This functional version of map accepts our function first.
const map = (fn, array) => array.map(fn);
// `pluck` allows us to map through a matrix, gathering all the items at a
@codeforkjeff
codeforkjeff / solarize.sh
Created November 27, 2011 06:43
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@ry
ry / 20190802-oumuamua.md
Last active June 6, 2021 05:00
Example
@poetix
poetix / iterators.js
Created December 27, 2011 22:28
Lazy map, filter and reduce in Javascript
Iterators = (function() {
var each, map, filter, reduce, toArray, toObject;
function _map(iter, f) {
return {
hasNext: iter.hasNext,
next: function() { return f(iter.next()); }
};
}
@bvaughn
bvaughn / setupFilesAfterEnv.js
Created August 23, 2021 21:37
Jest config to remove extra console location / formatting noise
import { CustomConsole } from '@jest/console';
function formatter(type, message) {
switch(type) {
case 'error':
return "\x1b[31m" + message + "\x1b[0m";
case 'warn':
return "\x1b[33m" + message + "\x1b[0m";
case 'log':
default:
@ryyppy
ryyppy / hard-dependency.js
Last active July 8, 2022 14:01
Jest: Module Mocking vs. Simple Dependency Injection
// ###############################
// runPackager.js
// ###############################
// In this example, the IO function is tightly coupled with the implementation
import { execFileSync } from 'child_process';
type RunPackagerOptions = {
projectRoot: string, // CWD the react-native binary is being run from
targetDir: string, // Target directory absolute or relative to projectRoot (e.g. 'rna/')
@timothyis
timothyis / gulpfile.babel.js
Last active August 13, 2022 23:36
Gulp 4, ES6 gulpfile example
// Gulp module imports
import {src, dest, watch, parallel, series} from 'gulp';
import del from 'del';
import livereload from 'gulp-livereload';
import sass from 'gulp-sass';
import minifycss from 'gulp-minify-css';
import jade from 'gulp-jade';
import gulpif from 'gulp-if';
import babel from 'gulp-babel';
import yargs from 'yargs';
@watson
watson / redos.js
Last active December 15, 2022 17:11
Node.js ReDoS example
// for more info about ReDoS, see:
// https://en.wikipedia.org/wiki/ReDoS
var r = /([a-z]+)+$/
var s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa!'
console.log('Running regular expression... please wait')
console.time('benchmark')
r.test(s)