Skip to content

Instantly share code, notes, and snippets.

View bluefuton's full-sized avatar

Chris R bluefuton

View GitHub Profile
@eugene1g
eugene1g / AutogrowingTextarea.js
Last active January 12, 2017 02:29
React component for auto-expanding textareas
"use strict";
import React, {Component} from 'react';
import calcContentHeight from './dom-textarea-measure';
class AutogrowingTextarea extends Component {
constructor(props) {
this.props = props;
this.state = {};
this.textareaProps = sanitizeChildProps(props);
@floodedcodeboy
floodedcodeboy / setup remote key
Created May 20, 2013 10:46
Nice little bash function for adding ssh keys to remote hosts. Place this in your .profile file or where ever you're comfortable having this.
function setup_remote_key() {
cat ~/.ssh/id_rsa.pub | ssh $@ "cat - >> ~/.ssh/authorized_keys"
}
@madrobby
madrobby / date.rb
Created February 15, 2013 17:37
`Date.parse` with some extra leeway to handle user input errors. Handles things like `2013-02-31` (parses it as `2013-02-29`) and handles things in general like users would expect.
module Freckle
module Date
class << self
def parse(string)
raw = string.to_s.strip
return nil if raw.empty?
begin
# reverse order if we encounter "European" formatting
@tszarzynski
tszarzynski / ISampleInterface.as
Created August 30, 2012 10:14
Lightweight AS3 coding standard example
/*
* Copyright (c) 2012 Agency Republic
*
* Permission is hereby granted to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
*/
package com.agencyrepublic.template
{
/**
* Sample interface class.
@thealscott
thealscott / jquery.autolink.js
Created May 29, 2012 15:19
Extension of the handy autolink jQuery plugin, so that it has a method for handling twitter hashtags. Original from http://kawika.org/jquery/index.php
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@naholyr
naholyr / svn-branch.sh
Created February 1, 2012 15:51
Branching with SVN
# Retrieve repository URL
function svn-url() {
LANG=en_US svn info "$1" | grep '^URL *:' | sed 's/^URL *: //'
}
# Branching
function svn-branch() {
if [ ! -d .svn ]; then return 1; fi
if svn-url | grep '/trunk' &> /dev/null; then
echo trunk
@benpickles
benpickles / minify
Created January 4, 2011 21:17
Swiftly concat and minify JavaScript files from the command line
#!/usr/bin/env ruby
dry_run = ARGV.delete('--dry-run')
force = ARGV.delete('--force')
if ARGV.empty?
puts <<-USAGE
minify, swiftly concat and minify JavaScript files from the command line
Pass a single argument to create a .min.js version: