Skip to content

Instantly share code, notes, and snippets.

View bguiz's full-sized avatar

Brendan Graetz bguiz

View GitHub Profile
@bguiz
bguiz / sleep-until-modified-invoke.sh
Created November 3, 2013 09:57
useful for automating deployments
wget https://bitbucket.org/denilsonsa/small_scripts/raw/9159fee62dc7cca7f81f47cef41bd9ae1324553e/sleep_until_modified.py
chmod u+x ./sleep_until_modified.py
touch testfile.old
touch testfile
#note limitation of this script: needs file to exist beforehand
while ./sleep_until_modified.py testfile || sleep 1; do echo "diff detected" $( date -u --rfc-3339=seconds ) ; diff testfile.old testfile ; cp testfile testfile.old ; done
@bguiz
bguiz / diamond-using-async.js
Created October 20, 2013 11:03
A comparison of async to qryq in specifying a compound query that is diamond-shaped. http://bguiz.com/post/64567226287/a-sneak-peek-from-my-talk-about-qryq-at-osdc-2013
var async = require('async');
var _ = require('underscore');
var api = {
add: function(qry, callback) {
if (!qry || ! _.isNumber(qry.a) || ! _.isNumber(qry.b)) {
callback('Must specify two numeric params, a and b. Params were: '+JSON.stringify(qry), null);
}
else {
callback(null, qry.a + qry.b);
var Foo = Backbone.Model.extend({
/* some code here */
});
//Default sollection
Foo.Collection = Backbone.Collection.extend({
model: Foo
/* some code here */
});
@bguiz
bguiz / letsencrypt-help-all.txt
Created December 15, 2015 01:09
LetEncrypt command line manpage
$ letsencrypt-auto --help all
Updating letsencrypt and virtual environment dependencies.......
usage:
letsencrypt [SUBCOMMAND] [options] [-d domain] [-d domain] ...
The Let's Encrypt agent can obtain and install HTTPS/TLS/SSL certificates. By
default, it will attempt to use a webserver both for obtaining and installing
the cert. Major SUBCOMMANDS are:
(default) run Obtain & install a cert in your current webserver
@bguiz
bguiz / shimForNewHtmlElements.css
Created May 28, 2013 11:51
css shim/ reset for new elements introduced in HTML5. see http://diveintohtml5.info/semantics.html#new-elements for a full discussion. #ft #html5
article,aside,details,figcaption,figure, footer,header,hgroup,menu,nav,section {
display:block;
}
@bguiz
bguiz / semantic.css
Created May 28, 2013 11:40
semantic FT view modules #ft #html5
.apple h2 {
//...
}
.apple h3 {
//...
}
.apple section {
//...
@bguiz
bguiz / improved.css
Created May 28, 2013 11:39
improve FT view modules #ft #html5
<div class="apple">
<h2 class="headline">{{headline}}</h2>
<h3 class="sub-head">{{subhead}}</h3>
<div class="body">{{body}}</div>
</div>
@bguiz
bguiz / original.css
Created May 28, 2013 11:12
original FT view modules #ft #html5
.apple {}
.apple_headline {
//...
}
.apple_sub-head {
//...
}
@bguiz
bguiz / jsbin.wiyin.html
Created March 5, 2014 05:13
Simple Ember App that displays items using the Master-Detail Pattern, with nested routes, and index routes
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[simple ember app that display foos using master-detail pattern & nested route & index]" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.3.2/ember.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
@bguiz
bguiz / convert-angularjs-from-bower-globals-to-commonjs-require.js
Last active August 29, 2015 14:16
output a composition root from conventional bower based angularjs projects to a bundled browserified project using gulp
/* jshint node: true */
'use strict';
var gulp = require('gulp'),
bower = require('./bower'),
replace = require('gulp-replace'),
through2 = require('through2');
/**