Skip to content

Instantly share code, notes, and snippets.

@sarink
sarink / node-exec.js
Created October 6, 2020 19:45
promise-based node exec with stdout logging
const { spawn } = require('child_process');
const exec = (command, args = []) => {
return new Promise((resolve, reject) => {
console.log('');
console.log(`${command} ${args.join(' ')}`);
const proc = spawn(command, args);
proc.stdout.pipe(process.stdout);
proc.stderr.pipe(process.stderr);
@sarink
sarink / cloudSettings
Last active April 29, 2020 15:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-04-01T15:56:19.123Z","extensionVersion":"v3.4.3"}
// Paste in your console for sweet dom notifier beeps
(function() {
var GRACE_PERIOD = 15000;
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT
@sarink
sarink / docker-readme.md
Last active January 28, 2017 21:34
docker-readme

Docker for <project_name>

Overview/Things to Know

Machine

Our machine name is "<company_name>"

A docker machine is the underlying virtual machine that your container runs on. You shouldn't really ever have to worry about it.

javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.10.2",function($,L){$(".toc_section").each(function() { var $section = $(this); var listitems = $section.children('li').get(); listitems.sort(function(a, b) { return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase()); }); $.each(listitems, function(idx, itm) { $section.append(itm); });});});
@sarink
sarink / SampleComponent.jsx
Last active August 29, 2015 14:19
backbone-react
// use like:
// var sample1 = new SampleModel();
// React.render(<SampleComponent model={sample1} />);
define(["underscore", "backbone", "react"],
function(_, Backbone, React) {
"use strict";
var SampleComponent = React.createClass({
// Give us those sweet react console warnings if we don't pass the right props
// Adds `ng-context-menu` for right click support
app.directive("ngContextMenu", function($parse) {
return function(scope, element, attrs) {
var fn = $parse(attrs.ngContextMenu);
element.bind("contextmenu", function(event) {
scope.$apply(function() {
event.preventDefault();
fn(scope, {$event:event});
});
});
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], function($) {
return factory($);
});
}
else if (typeof exports !== "undefined") {
var $ = require("jquery");
module.exports = factory($);
}
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define(["underscore"], function(_) {
return factory(_);
});
}
else if (typeof exports !== "undefined") {
var _ = require("underscore");
module.exports = factory(_);
}
// Forked/modified from: https://gist.github.com/maxbrunsfeld/1542120
// This method gives you an easier way of calling super when you're using Backbone in plain javascript.
// It lets you avoid writing the constructor's name multiple times.
// You still have to specify the name of the method.
//
// So, instead of having to write:
//
// var Animal = Backbone.Model.extend({
// word: "",
// say: function() {