<html> | |
<head> | |
<title>JavaScript - Set Homepage</title> | |
</head> | |
<body> | |
<input type="button" value="Set homepage" onclick="setHomepage('http://www.google.com');" /> | |
<script language="javascript"> | |
function setHomepage(url) { | |
if (document.all) { | |
document.body.style.behavior='url(#default#homepage)'; |
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" ================ General Config ==================== | |
set number "Line numbers are good | |
set backspace=indent,eol,start "Allow backspace in insert mode | |
set history=1000 "Store lots of :cmdline history | |
set showcmd "Show incomplete cmds down the bottom |
// ES6 version using asynchronous iterators, compatible with node v10.0+ | |
const fs = require("fs"); | |
const path = require("path"); | |
async function* walk(dir) { | |
for await (const d of await fs.promises.opendir(dir)) { | |
const entry = path.join(dir, d.name); | |
if (d.isDirectory()) yield* walk(entry); | |
else if (d.isFile()) yield entry; |
The MBP is my development machine, so I needed all of my tools installed with the ability to update them with ease. In the past, I used MacPorts to take care of my MySQL, Memcached, and Ruby installions and it worked just fine. This time around however, I wanted something new and fun. Homebrew.
Homebrew is a new package manager for OS X. Unlike Fink or MacPorts, Homebrew integrates with the core operating system, reducing the number of extra libraries to install etc. Another neat feature is the ability to write software package recipes in Ruby, awesome.
Here are some raw installation instructions (clean system). I like to keep everything under user ownership to make life more enjoyable, say no to sudo.
You will need the latest version of xcode, you can get it here. After the installation is complete, you may continue.
sudo mkdir /usr/local
/** @jsx React.DOM */ | |
// d3 chart function | |
// note that this is a higher-order function to | |
// allowing passing in the component properties/state | |
update = function(props) { | |
updateCircle = function(me) { | |
me | |
.attr("r", function(d) { return d.r; }) | |
.attr("cx", function(d) { return 3 + d.r; }) |
#Create a redirect server in Node.js
'use strict'
var http = require('http');
var mappings = {
g: 'http://www.google.com'
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
# that enables you to choose a character from a menu of options. If you are on Lion | |
# try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
# for input. | |
# | |
# It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
# it's a nightmare to deal with in Atom if you're running vim mode, | |
# as it means you cannot press and hold h/j/k/l to move through your file. You have | |
# to repeatedly press the keys to navigate. |
#!/bin/bash | |
# A script to convert a CSV (excel export) file into JSON | |
# Usage ./csv2json input.csv > output.json | |
# Slightly modified version of SECAGUY's: | |
# http://blog.secaserver.com/2013/12/convert-csv-json-bash/ | |
input=$1 | |
[ -z $1 ] && echo "No CSV input file specified" && exit 1 | |
[ ! -e $input ] && echo "Unable to locate $1" && exit 1 |
git branch -m master newname | |
git push origin newname | |
# Change "Default Branch" in settings/options in GitHub | |
git push origin :master |