Skip to content

Instantly share code, notes, and snippets.

" Map Leader
let mapleader = ","
imap jj <Esc> " map jj to escape
:map <leader>dd "_dd " Map ',dd' to delete line and put in black-hole register
nmap <leader>w :w!<cr> " Shortcut
" Fast editing of the .vimrc
map <leader>e :e! ~/.vimrc<cr>
" When vimrc is edited, reload it
@kconragan
kconragan / vimrc
Created January 11, 2012 23:59
vimrc
" Map Leader
let mapleader = ","
imap jj <Esc> " map jj to escape
:map <leader>dd "_dd " Map ',dd' to delete line and put in black-hole register
nmap <leader>w :w!<cr> " Shortcut
" Fast editing of the .vimrc
map <leader>e :e! ~/.vimrc<cr>
" Initiate Pathogen
var moment = require('moment');
var request = require('request');
exports.formatDate = function(format, date) {
};
// Takes NDBC Buoy ID, and returns
// series of readings
var fetchBuoy = function(buoyId) {
request('http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt', function(err, response, body){
// Takes NDBC Buoy ID, and returns
// series of readings
var fetchBuoy = function(buoyId) {
var path = 'http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt';
request(path, function(err, response, body) {
if(err) {
throw err;
}
return body;
});
for(i = 0; i < results.length; i++) {
var row = results[i];
// construct timestamp for raw results
// YYYY-MM-DD H:H ZZ
// Sample: 2012-04-13 00:10 +0000
var t =row[0] + "-" + row[1] + "-" + row[2] + ' ' + row[3] + ":" + row[4] + ' +0000'
// TODO
// format date an respect timezone
// controller
exports.createWave = function(req, res) {
// buoys come in from client sorted
var buoys = req.body.wave.buoys;
// how would I add an index to them
// and save below?
var wave = new Wave({
@kconragan
kconragan / dabblet.css
Created April 26, 2012 17:09 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@kconragan
kconragan / dabblet.css
Created April 26, 2012 17:51
Subtle CSS hatch pattern
body {
background-color:#f1f2f3;
background-image:
linear-gradient(rgba(0,0,0,.015) 1px, transparent 1px),
linear-gradient(0, rgba(0,0,0,.015) 1px, transparent 1px);
background-size:5px 5px;
background-position:-1px -1px, -1px -1px
}
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# 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 Sublime Text if you're running Vintage (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.
@kconragan
kconragan / helpers.js
Created April 30, 2012 15:18
Generic request handler for returning a promise when requesting a url
/*
* Internal: Convert the request for a url into a promise
*
* url - the String to fetch
*
* Example: return request('http://www.google.com')
*
* Returns a promise
*/
var request = function(url) {