Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@cabo
cabo / catdocx.rb
Created January 10, 2011 20:43
quickly extract the text from a MOOX ("OOXML") .docx file
#!/opt/local/bin/ruby1.9
require 'zip/zipfilesystem'
require 'nokogiri'
MS_S = "http://schemas.openxmlformats.org/"
MS_W = MS_S + "wordprocessingml/2006/main"
MS_W_OD = MS_S + "officeDocument/2006/relationships/officeDocument"
ARGV.each do |fn|
Zip::ZipFile.open(fn) do |zf|