Skip to content

Instantly share code, notes, and snippets.

View chrisbraddock's full-sized avatar

Chris Braddock chrisbraddock

View GitHub Profile
@chrisbraddock
chrisbraddock / gist:6082304
Created July 25, 2013 18:13
make jshint ignore lines/errors - thanks Brophy
// Between those lines, the W116 error will not be checked
// To get the error code, run on the command line: jshint --verbose <file>
/*jshint -W116 */
if (arr1[i] != arr2[i]) { return false; }
/*jshint +W116 */
@chrisbraddock
chrisbraddock / cron_legend
Last active December 20, 2015 12:49
cron legend
***** command to execute
┬┬┬┬┬
│││││
│││││
││││└───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names)
│││└────────── month (1 - 12)
││└─────────────── day of month (1 - 31)
│└──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
{
"name": "best-practices",
"description": "A package using versioning best-practices",
"author": "Charlie Robbins <charlie@nodejitsu.com>",
"main": "my-module.js",
"repository": {
"type": "git",
"url": "https://github.com/npm/npm.git"
},
"dependencies": {
(function( skillet, $, undefined ) {
//Private Property
var isHot = true;
//Public Property
skillet.ingredient = "Bacon Strips";
//Public Method
skillet.fry = function() {
var oliveOil;
@chrisbraddock
chrisbraddock / change-app-priority.sh
Created May 1, 2014 14:22
osx change application (process) prirotity
sudo renice -10 <PID> # -20 is highest priority; 0 is normal
@chrisbraddock
chrisbraddock / large-xfer.sh
Last active October 31, 2016 11:58
transfer large amount of files - e.g. a large multi-terabyte directory with many subdirectories between physical drives
# -f If the destination file cannot be opened, remove it and create a new file, without
# prompting for confirmation regardless of its permissions. (The -f option overrides
# any previous -n option.)
# -p Cause cp to preserve the following attributes of each source file in the copy: mod-
# ification time, access time, file flags, file mode, user ID, and group ID, as
# allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs),
# including resource forks, will also be preserved.
#
# If the user ID and group ID cannot be preserved, no error message is displayed and
# the exit value is not altered.
@chrisbraddock
chrisbraddock / keybase.md
Created November 20, 2014 20:20
Keybase proof

Keybase proof

I hereby claim:

  • I am chrisbraddock on github.
  • I am chrisbraddock (https://keybase.io/chrisbraddock) on keybase.
  • I have a public key whose fingerprint is F484 5D5C 1500 A77F 097A 2AA7 656A 04EC E98C DC42

To claim this, I am signing this object:

@chrisbraddock
chrisbraddock / q-finally.js
Last active August 29, 2015 14:21
$q finally
var $q = angular.element(document).injector().get('$q');
function fn1() {
return $q.when('foo');
}
function fn2(arg) {
console.log('fn2', arguments);
return $q.when(arg);
}
// server
var express = require('express');
var request = require('request');
var apiServerHost = 'http://api.openweathermap.org';
var app = express();
app.use(function(req, res) {
var url = apiServerHost + req.url;
console.log('serving:', url);
req.pipe(request(url)).pipe(res);
public class Value {
private boolean modified = false;
private int val;
public Value(initialVal) {
val = initialVal;
}
public void setVal(int newVal) {
val = newVal;