Skip to content

Instantly share code, notes, and snippets.

@dbuentello
dbuentello / Gulpfile.js
Last active August 26, 2015 20:04 — forked from webdesserts/Gulpfile.js
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.

#A brief intro into Stateless functions#

So stateless functions are new in React 0.14 which are quite interesting. They look a bit like this.

const Test = ({name, amount}) => {
 return <div className="test">{name} has £{amount}</div>;
};

ReactDOM.render(<Test name="ben" amount="-2000" />) //  <div className="test">ben has £-200</div> 
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@dbuentello
dbuentello / IdeaVim OS X Key Repeat.markdown
Created February 9, 2016 09:46 — forked from lsd/IdeaVim OS X Key Repeat.markdown
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

@dbuentello
dbuentello / t2_log_boot.js
Created September 1, 2016 13:09
Log tessel2 boot in a sane way.
// Because "hit enter as fast as you can"
/*
1. Requires serialport module (npm install serialport)
2. Run with node (node t2_log_boot.js)
3. Plug in tessel2.
*/
/* Figure out what port your tessel2 is plugged into and update the SERIAL_PORT variable. */
const SERIAL_PORT = '/dev/cu.usbmodem1412';
@dbuentello
dbuentello / osx_nmap_dmg_uninstall.sh
Created September 16, 2017 23:17
Uninstall nmap from osx installed via dmg
#!/bin/sh
receipts() {
find /private/var/db/receipts -iregex '.*/org\.insecure\.nmap.*'
}
bom_files() {
receipts | grep '\.bom$'
}
@dbuentello
dbuentello / git-backup-to-Backblaze-B2.sh
Created June 26, 2018 14:46 — forked from nilayp/git-backup-to-Backblaze-B2.sh
Complete git repository backup script to Backblaze B2
#!/bin/bash
# Script to backup git repo to Backblaze B2
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
# Ensure you have authorized the B2 command line tool with the correct account AND added your SSH
# public key to your github account, if you need to backup private repositories.
# To restore this repo in the future, download it from B2, extract it and then use this command:
# cd old-repository.git
@dbuentello
dbuentello / git-backup-to-Backblaze-B2.sh
Created June 26, 2018 14:46 — forked from nilayp/git-backup-to-Backblaze-B2.sh
Complete git repository backup script to Backblaze B2
#!/bin/bash
# Script to backup git repo to Backblaze B2
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
# Ensure you have authorized the B2 command line tool with the correct account AND added your SSH
# public key to your github account, if you need to backup private repositories.
# To restore this repo in the future, download it from B2, extract it and then use this command:
# cd old-repository.git
@dbuentello
dbuentello / README-Template.md
Created March 6, 2019 20:51 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dbuentello
dbuentello / aws.upload-folder-to-s3.js
Created May 30, 2020 19:16 — forked from jlouros/aws.upload-folder-to-s3.js
Upload folder to S3 (Node.JS)
const AWS = require("aws-sdk"); // from AWS SDK
const fs = require("fs"); // from node.js
const path = require("path"); // from node.js
// configuration
const config = {
s3BucketName: 'your.s3.bucket.name',
folderPath: '../dist' // path relative script's location
};