Skip to content

Instantly share code, notes, and snippets.

Avatar

Nik Sumeiko niksumeiko

View GitHub Profile
@keriati
keriati / git-list-todos.sh
Created Sep 30, 2022
List todos in codebase and git blame
View git-list-todos.sh
git grep -ino "// TODO" | cut -d":" -f1-2 | sed 's/:/ /g' | sed 's/\(.*\) \(.*\)/\2,\2 \1/g' | xargs -r -L 1 git blame -c -L > todo-lol.txt
View sharp.d.ts
// Type definitions for sharp v0.16.2
// Project: https://github.com/lovell/sharp
// Definitions by: Matthew McEachen <https://github.com/mceachen/>
/// <reference types="node" />
import * as stream from "stream"
import * as events from "events"
// See https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html
@Couto
Couto / webpack.js
Last active Nov 11, 2020
Fetch polyfill with webpack
View webpack.js
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@backflip
backflip / gulpfile.js
Created Feb 3, 2014
Gulp.js: Process SASS to CSS and auto-prefix the necessary properties
View gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('css', function() {
return gulp.src('./source/assets/css/main.scss')
.pipe(sass({
style: gutil.env.production ? 'compressed' : 'expanded'
}))
@rtgibbons
rtgibbons / logger.js
Created Nov 7, 2013
Logger Library with winston
View logger.js
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@keeguon
keeguon / countries.json
Created Apr 5, 2012
A list of countries in JSON
View countries.json
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@louismullie
louismullie / gist:2089431
Created Mar 19, 2012
Space-filling with an arbitrary number of circles with predefined radii
View gist:2089431
/*
*
* Space-filling with circles
*
* Authors: Kris Van Bael.
* Small modifications by Louis Mullie.
*
*
* Usage:
*
@gnarf
gnarf / jQuery.ajaxQueue.min.js
Created Jun 21, 2011
jQuery.ajaxQueue - A queue for ajax requests
View jQuery.ajaxQueue.min.js
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Sep 25, 2022
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh