Skip to content

Instantly share code, notes, and snippets.

@chrislearn
chrislearn / is_installed.sh
Created September 23, 2015 12:01 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script. Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@chrislearn
chrislearn / 0_reuse_code.js
Created November 20, 2013 07:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@chrislearn
chrislearn / console.js
Created November 20, 2013 12:23
console functions
(function (con) {
'use strict';
var prop, method;
var empty = {};
var dummy = function () { };
var properties = 'memory'.split(',');
var methods = ('assert,count,debug,dir,dirxml,error,exception,group,' +
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,' +
'time,timeEnd,trace,warn').split(',');
while (prop = properties.pop()) con[prop] = con[prop] || empty;
@chrislearn
chrislearn / rAF.js
Created November 27, 2013 04:36 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];

MacOS

Download from here:

http://d.pr/f/QE3d

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to:

@chrislearn
chrislearn / README.md
Created February 26, 2016 07:51 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js

To run this, you can try:

curl -ks https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

@chrislearn
chrislearn / gulp-php.js
Created April 1, 2016 03:49 — forked from jasonrhodes/gulp-php.js
Simple stream example for modifying file contents in gulp plugins
var through = require("through2");
var exec = require("child_process").exec;
// through2 docs: https://github.com/rvagg/through2
module.exports = function (options) {
// Not necessary to accept options but nice in case you add them later
options = options || {};
@chrislearn
chrislearn / webcryptoapi.html
Created November 13, 2018 04:43 — forked from deiu/webcryptoapi.html
Web Crypto API: RSA keygen & export & import & sign & verify & encrypt & decrypt
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
})