Skip to content

Instantly share code, notes, and snippets.

View bguiz's full-sized avatar

Brendan Graetz bguiz

View GitHub Profile
@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 / 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');
/**
@bguiz
bguiz / svg-9slice-scaling.svg
Created January 20, 2015 05:18
svg 9-slice scaling - +chrome + firefox -ie
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bguiz
bguiz / group-slice.svg
Created January 20, 2015 02:53
Demonstrates how to slice an SVG into a 3x3 grid using symbol with viewBox+preserveAspectRatio, and then reassmble into original
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bguiz
bguiz / quick-select-in-place.js
Created July 29, 2014 01:39
Quick select implementation in Javacript
/*
* Places the `k` smallest elements (by `propName`) in `arr` in the first `k` indices: `[0..k-1]`
* Modifies the passed in array *in place*
* Returns a slice of the wanted eleemnts for convencience
* Efficent mainly due to never performaing a full sort.
*
* The only guarantees are that:
*
* - The `k`th element is in its final sort index, if the array were to be sorted
* - All elements before index `k` are smaller than the `k`th element
@bguiz
bguiz / efficient-dropbox.sh
Created July 10, 2014 00:28
Runs dropbox at intervals, so as not to create too many deltas
#!/bin/bash
# Runs dropbox at intervals, so as not to create too many deltas
SYNC_CHECK_INTERVAL=60
SLEEP_INTERVAL=900
while true ; do
echo "Dropbox watch loop"
dropbox start
while true ; do
@bguiz
bguiz / vbox-mount.sh
Created July 8, 2014 01:11
mounts virtualbox shared directories
#!/bin/bash
# Mounts all known drives shared via virtual box
# configuration
MOUNT_POINT="${HOME}/media"
MOUNT_DIRS="foo bar" #replace with the ones you have configured for your virtual machine
USERID=$( id -u )
GROUPID=$( id -g )
for DIR in ${MOUNT_DIRS} ; do
@bguiz
bguiz / add-broccoli-compass-to-ember-cli-app.md
Last active August 29, 2015 14:02
How to add broccoli-compass to an ember-cli app

Run the following commands:

gem install --pre compass sass-css-importer
npm install --save-dev broccoli-static-compiler broccoli-merge-trees broccoli-compass

(This assumes that you already have Ruby and NodeJs installed)

Then add the contents of snippet-add-broccoli-compass-to-ember-cli-app.js to your Brocfile.js,

{{!--
Sample usage in handlebars template
Say you wish to display an undordered list (`<ul>`) of `Foo` models,
and only one of these `Foo`s can be selected as the primary `Foo`.
We bind each `Foo` to a radio button, with the `checked` attribute
of the radio button updating the `primary` attribute of the `Foo` model.
--}}
{{#view App.RadioButtonGroupView name='foo-group'}}
@bguiz
bguiz / modernizr-cli.js
Last active August 29, 2015 13:57
Modernizr 3.0 command line
/*globals console, process, __dirname */
var modernizr = require('./lib/cli');
var fs = require('fs');
var args = process.argv.slice(2);
console.log('CLI arguments:', args);
if (args.length < 3) {
console.error('Expects three arguments: config, output, minifiedOutput');