Skip to content

Instantly share code, notes, and snippets.

View 0xadada's full-sized avatar
🦅

0xADADA 0xadada

🦅
View GitHub Profile
@jtpaasch
jtpaasch / clean_branch.sh
Created May 30, 2014 15:25
Recreate a git branch clean
#!/bin/bash
# We want to clear out the "rc" branch. To do that, we need
# to be on a different branch. We'll get onto "master".
# Does master exist? The first command's status code
# will be "0" if the branch exists.
git show-ref --verify --quiet refs/heads/master
MASTER_EXISTS=$?
var oauth = require('oauth')
, request = require('request')
;
module.exports = function(app, params, cb) {
if(!params.consumer_key) { throw new Error('Please provide a consumer key.'); }
if(!params.consumer_secret) { throw new Error('Please provide a consumer secret.'); }
if(!params.callback_url) { throw new Error('Please provide callback url.'); }
if(!cb) { throw new Error('Please provide a callback'); }
@tonykevin
tonykevin / archlinux-virtualbox.sh
Created March 9, 2016 21:42 — forked from GabLeRoux/archlinux-virtualbox.sh
Virtualbox archlinux notes
# sudo /sbin/rcvboxdrv -h
# Unloading modules:
# Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH
# Solution
# from https://forum.antergos.com/topic/818/can-t-run-my-vitualbox/4
@amatiasq
amatiasq / curry.js
Last active March 15, 2019 10:34
Simple way to recursively curry javascript functions http://jsfiddle.net/amatiasq/osrsomq0/
/**
* @param {Function} fn Function to curry.
* @param {Number} lenght The arguments required to invoke the function. Optional. By default is fn.length
* @returns {Function} The currified function.
*/
function curry(fn, length) {
length = length || fn.length;
return function currified() {
var args = [].slice.call(arguments);
@rolandinsh
rolandinsh / gist:3510701
Created August 29, 2012 11:04
Do Not Track (DNT) detect with PHP code
function get_smc_dnt() {
/*
* Do Not Track for privacy.
* When this feature is enabled, webpage should exclude all tracking tools,
* like Google Analytic and advertising networks
*/
// returns TRUE if DNT is on and is equal to 1,
// returns FALSE if DNT is unset OR not equal to 1
return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1);
}
@dchest
dchest / salsa20.js
Last active November 9, 2020 02:48
/*
IMPORTANT!!! DO NOT USE THIS. It works, but you'll probably get it wrong,
because it must be keyed with at least 128 bits of entropy, and where
do you get this entropy, huh?
- In a browser, you get it from window.crypto.getRandomValues().
- In Node, you get it from crypto.randomBytes()
Now LOOK AT YOU! You already have secure ways to generate random bytes,
@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.

@johan
johan / laughing-man.svg
Created July 6, 2011 04:56
The Laughing Man (Ghost in the Shell), 1000 byte SVG :-)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 5, 2024 13:30
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx