Skip to content

Instantly share code, notes, and snippets.

class QuestionAnswerer
def say_hello
"Hey there! Just wanting to test out the gist API"
end
end
var input = new mOxie.FileInput({ browse_button: '#filePicker' });
var formData = new mOxie.FormData();
input.bind('change', function(e) {
formData.append('myFile', e.target.files[0]);
var xhr = new mOxie.XmlHttpRequest();
xhr.open('POST', 'http://localhost:3000', true);
xhr.send(formData);
});
@derrickwilliams
derrickwilliams / gist:0af27bc9157c8d71949d
Created September 13, 2014 03:01
safe property getter function
function getter(o, propChain, undefinedDefault) {
var
props = propChain.split('.'),
len = props.length,
val = o;
for (var i = 0; i < len; i++) {
val = val[props[i]];
if (val === undefined) break;
}
@derrickwilliams
derrickwilliams / gist:5ba2e05a11eb51d04ee6
Last active August 29, 2015 14:08
if/else function call syntax
var doIt = true, dontDoIt = false;
(doIt ? call1 : call2).call(null, 'hey there');
(dontDoIt ? call1 : call2).call(null, 'hey there');
(dontDoIt ? call1 : call2)('hey there');
// as alternative to:
if (doIt) {
call1('hey there');
}
@derrickwilliams
derrickwilliams / 0_reuse_code.js
Created June 6, 2016 13:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$(function() {
console.log('YOUVE BEEN INJECTED!!!');
})
{
"src_folders": "./tests",
"output_folder": "./results",
"selenium" : {
"start_process" : true,
"server_path" : "./node_modules/selenium-server/lib/runner/selenium-server-standalone-2.38.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 3333
},
@derrickwilliams
derrickwilliams / cadvisor_docker_run.sh
Created September 18, 2016 22:06
Run google cadvisor in container
sudo docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest
{
"name": "[update name]",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build.lib": "./node_modules/.bin/babel -D -s false -d ./lib ./src/lib",
"build.lib.w": "npm run build.lib -- -w",
module.exports = {
env: {
es6: true,
node: true
},
extends: 'standard',
rules: {
indent: [2, 2, {"SwitchCase": 1}],
//overrides