Skip to content

Instantly share code, notes, and snippets.

pabloasanchez / Tab Context.sublime-menu
Last active Dec 21, 2020
Sublime Text 3 Plugin: Close all saved tabs
View Tab Context.sublime-menu
{ "caption": "-" },
{ "command": "close_saved", "caption": "Close Saved Files" }
matttti / effect-generators.js
Created Jan 28, 2017
[redux-saga]: flow-typing of yield return values
View effect-generators.js
import * as IOEffects from 'redux-saga/effects'
export function * select (...args) {
return yield
export function * put (...args) {
return yield IOEffects.put(...args)
nphyx / test-DataView_Uint42Accessors.js
Created Sep 14, 2015
Unit test for unsigned 24-bit int accessors for Javascript DataViews.
View test-DataView_Uint42Accessors.js
describe("DataView", function() {
it("should implement Uint24 accessors", function() {
var i, n, buf, dv;
buf = new ArrayBuffer(3);
dv = new DataView(buf);
n = Math.pow(2, 24);
// this should give us decent coverage without trying every single number, which takes forever
for(i = 1; i < n; i += 111) {
dv.setUint24(0, i);
chrismdp /
Last active May 6, 2021
Uploading to S3 in 18 lines of Shell (used to upload builds for
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
yuanqing / gist:87bceacedde4dbd96fab
Last active Sep 16, 2020
Sublime Text: Wrap Selection in Backticks
View gist:87bceacedde4dbd96fab
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context":
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
mobilemind /
Last active May 4, 2021
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
firstdoit /
Created Aug 30, 2013
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
thomassuckow / karma.js
Last active Jun 18, 2017
Using karma to load requirejs tests with the .spec.js suffix. Note the base url needs the / otherwise karma-requirejs will whine about no timestamp (paths will differ) We mangle the files list to be relative, otherwise using relative paths in the form of "./bar" will fail. In my use case I have a shared config.js file that has more configuration…
View karma.js
var tests = Object.keys(window.__karma__.files).filter(function (file) {
return /\.spec\.js$/.test(file);
return file.replace(/^\/base\/src\/js\/|\.js$/g,'');
baseUrl: '/base/src/js',
paths: {
matthiasg / docs style (bootstrap)
Created Aug 5, 2013
the callouts from the bootstrap documentation
View docs style (bootstrap)
/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
amitchhajer / Count Code lines
Created Jan 5, 2013
Count number of code lines in git repository per user
View Count Code lines
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n