Skip to content

Instantly share code, notes, and snippets.

View curtisharvey's full-sized avatar

Curtis Harvey curtisharvey

  • School Current
  • Portland, OR
View GitHub Profile
@curtisharvey
curtisharvey / bitbucket-pr-branches.user.js
Last active April 21, 2016 18:00
Ugly hack to add "Source" and "Target" columns to Bitbucket Pull Requests list
/*jslint browser:true*/
// ==UserScript==
// @name Bitbucket PR branches
// @namespace http://curtisharvey.com/
// @version 0.1
// @description Ugly hack to add "Source" and "Target" columns to Bitbucket Pull Requests list
// @author Curtis Harvey
// @match https://bitbucket.org/*/pull-requests/
// @match https://bitbucket.org/*/pull-requests/?displaystatus=open
// ==/UserScript==
@curtisharvey
curtisharvey / parse-time.php
Created July 22, 2015 18:52
atempt at time parsing in php
<?php
/**
* Parse various time formats into standard H:i:s format (e.g. "2:30pm" -> "14:30:00").
*
* @param string $timeString Time to parse
* @param boolean $includeSeconds Optionally include seconds, default = true
*
* @return string|null Null if unable to parse time
*/
function parseTime($timeString, $includeSeconds = true) {
@curtisharvey
curtisharvey / gist:1907399
Created February 25, 2012 08:51
node_versions bash function
node_versions ()
{
local ver_re='v[0-9]+\.[0-9]+\.[0-9]+';
local active="$(node --version 2> /dev/null)";
local installed=($(nvm ls | grep -vE ':|->' | grep -oE "$ver_re" | sort -u));
local aliased=($(nvm alias | sed 's/ -> /:/'));
local latest="$(curl -s http://nodejs.org/dist/latest/ -o - | grep -oE "$ver_re" | sort -u)";
local output="";
curl -s http://nodejs.org/dist/ -o - | grep -oE "$ver_re" | sort -uV | while read v; do
output="$v";
@curtisharvey
curtisharvey / todone
Created March 28, 2011 07:43
commit modified files using lines removed from TODO.md as commit message
# commit modified files using lines removed from TODO.md as commit message
git ci -am "$(git diff "TODO.md" | awk '/^-\* / {printf substr($0, 4)"; "}')"
# make it easier by adding an alias to .gitconfig
[alias]
todone = "!git ci -am \"$(git diff \"TODO.md\" | awk '/^-\* / printf substr($0, 4)\"; \"}')"
# make it smarter by looking for the TODO.md file or accepting it as an argument
[alias]
todone = "!f () {\
@curtisharvey
curtisharvey / ports_admin
Created August 18, 2010 16:27
ports_admin - simple bash script to help manage macports
#!/bin/bash
if [[ $(id -u) != 0 ]]; then
echo "Script requires root priviliges"
echo "Run with: sudo $(basename $0)"
exit 1
fi
ask () {
echo -ne "===> $@ [y/n] "
diff --git a/src/editor/js/selection.js b/src/editor/js/selection.js
index a046f0a..448cbf8 100644
--- a/src/editor/js/selection.js
+++ b/src/editor/js/selection.js
@@ -143,34 +143,20 @@
* @method filterBlocks
*/
Y.Selection.filterBlocks = function() {
- var childs = Y.config.doc.body.childNodes, i, node, wrapped = false, doit = true,
- sel, single, br, divs, spans, c, s;
@curtisharvey
curtisharvey / loader.js
Created July 29, 2010 06:55
YUI seed loader
/**
* Light-weight YUI-dependend Script Loader
* - loads YUI 3 if not already loaded
* - then loads your script(s)
*
* Useful for dynamically loaded modules, injected scripts, bookmarklets, etc…
*/
(function() {
// YUI to load if unavailable
@curtisharvey
curtisharvey / collatz.js
Created July 27, 2010 05:35
simple Collatz Conjecture in node
#! /usr/local/bin/node
var sys = require('sys'),
iter = [],
start = (process.argv.length > 2) ? parseInt(process.argv[2], 10) : null,
stdin;
function askForNumber() {
sys.print('enter a number: ');
if (stdin) {