Skip to content

Instantly share code, notes, and snippets.

@fghhfg
fghhfg / GitHub curl.sh
Created March 19, 2018 19:02 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@fghhfg
fghhfg / diigo-oneclick-bookmarklet.js
Last active January 21, 2018 03:03 — forked from avivo/diigo-oneclick-bookmarklet.js
A bookmarklet to make a diigo bookmark with a default tag with one click.
javascript:
(function(){
var path = 'https://secure.diigo.com/api/v2/bookmarks';
var params = {
'url': document.URL,
'title': document.title,
'tags': 'oneclick',
'shared': 'no'
};
@fghhfg
fghhfg / self-eq-this-vs-bind.md
Created November 12, 2017 14:38 — forked from jashmenn/self-eq-this-vs-bind.md
Javascript var self = this; vs. .bind

The Problem

In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:

var self = this;

as in:

var self = this;
@fghhfg
fghhfg / watch.sh
Last active May 2, 2016 17:50 — forked from mikesmullin/watch.sh
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#