Skip to content

Instantly share code, notes, and snippets.

@gilbert
gilbert / functions.js
Last active September 20, 2016 15:09
JavaScript Function Extensions
// Partially apply arguments to a function. Useful for binding
// specific data to an event handler.
// Example:
//
// var add = function (x,y) { return x + y }
// var add5 = add.papp(5)
// add5(7) //=> 12
//
Function.prototype.papp = function () {
var slice = Array.prototype.slice
@dfkaye
dfkaye / convert-es5-require-to-es6-import.txt
Created November 2, 2015 17:26
Convert ES5 requires to ES6 imports in ST ( regex by Hugo Giraudel )
from Hugo Giraudel, https://twitter.com/HugoGiraudel/status/661147120230100992
Convert ES5 requires to ES6 imports in ST:
Search:
var\s+(\w+)\s+\=\s+require\((("|')[a-zA-Z0-9\/\.-]+\3)\)\;?
Replace:
import $1 from $2;
;;;;;;;;;;;;;;;;;;;
;; Collections in Clojure
;;;;;;;;;;;;;;;;;;;
;; Distinctive characteristics
;;;;;;;;;;;;;;;;;;;
;; * They are mainly used in terms of abstractions, not the details of concrete implementations.
;; * They are immutable and persistent.
;;;;;;;;;;;;;;;;;;;
@awatson1978
awatson1978 / gist:a0df5fef953b9da01ce1
Last active May 19, 2017 11:57
Publish an Atom Package
command-shift-P > Package > Package Generator: Generate Syntax Theme > mypackage
cd ~/.atom/packages/mypackage
apm login
apm develop mypackage
cd ~/github/mypackage
sudo chown -R username:wheel .
git commit -a -m 'checking everything in'
apm publish --tag v2.5.0 minor
@17twenty
17twenty / dockerAndGo.md
Created September 26, 2016 00:21
Docker + Golang

Docker and Golang

This is a short collection of tips and tricks showing how Docker can be useful when working with Go code. For instance, I’ll show you how to compile Go code with different versions of the Go toolchain, how to cross-compile to a different platform (and test the result!), or how to produce really small container images.

This article assumes that you have Docker installed on your system. It doesn’t have to be a recent version (we’re not going to use any fancy feature here).

Go without Go

... And by that, we mean Go without installing go.

@lox
lox / Makefile
Last active March 28, 2018 12:55
Replaced Grunt/Gulp with a Makefile
SASSC = sass --style compact
COMPSDIR = resources/assets/components
SASSDIR = resources/assets/css
JSDIR = resources/assets/js
DISTDIR = web/dist
CSSDIR = $(DISTDIR)/css
SASSINC = $(SASSDIR) \
$(COMPSDIR)/asimov/src/scss \
$(COMPSDIR)/asimov-contests/src/scss \
$(COMPSDIR)/asimovicons/src/scss
@ryanj
ryanj / Developing-Locally-with-Kubernetes.html
Last active June 2, 2018 13:03
Developing Locally with Kubernetes from #Kubecon2017 in Austin, TX http://bit.ly/kubecon-dev
<section>
<section id="at-Kubecon-2017">
<img style="width:100%" src="https://i.imgur.com/znrD3yq.jpg" alt="Developing Locally with Kubernetes - http://bit.ly/kubecon-dev" />
<br/>
<a href="https://youtu.be/_W6O_pfA00s">youtu.be/_W6O_pfA00s</a>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at Red Hat</p>
<p class='fragment fade-up'><a href="http://twitter.com/ryanj/"><img alt="ryanj" src="http://ryanjarvinen.com/images/ryanj-mestrefungo-com.gif" style="width:48%"/></p>
</section>
@Gen2ly
Gen2ly / cb-out
Created June 7, 2012 10:59
Paste contents of Xorg clipboard to a file from the command line
#!/bin/bash
# Paste contents of Xorg clipboard to a file from the command line
filename=$@
pasteinfo="clipboard contents"
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <filename> - paste contents of context-menu clipboard to file"
exit
@leidegre
leidegre / channel-test.js
Created August 21, 2018 18:59
Go channel abstraction for JavaScript
const { default: Channel } = require("./channel");
const timeout = 100;
async function unbuffered() {
const xs = [];
var ch = new Channel();
xs.push("start");
setTimeout(async () => {
xs.push("timeout");