Skip to content

Instantly share code, notes, and snippets.

View ferronrsmith's full-sized avatar
⛱️
Chilling on the beach

Ferron H ferronrsmith

⛱️
Chilling on the beach
View GitHub Profile
@ferronrsmith
ferronrsmith / nghtml2js.js
Created December 10, 2013 14:19
Tests making use of ng-html2js module for karma
'use strict';
/* jasmine specs for directives go here */
describe('directives', function() {
beforeEach(module(
'partials/absenceAccordion.html',
'partials/directives/employeeAbsenceList.html',
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
package net.shadowraze.vote4diamondz;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@ferronrsmith
ferronrsmith / preg_quote.java
Created July 16, 2014 23:46
preg_quote java implementation
package com.gbi.utils;
import jregex.Pattern;
import jregex.PatternSyntaxException;
public class RegexUtil {
/**
* Java implementation of preg_quote
* {@link http://phpjs.org/functions/preg_quote/}
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@ferronrsmith
ferronrsmith / split.java
Created July 21, 2014 18:58
Delimited Split
private String split(String pInputString, String pDelim, int pMaxLength) {
int len = pInputString.length();
int times = len / pMaxLength;
boolean remainder = len % pMaxLength != 0;
int startIdx = 0;
int endIdx = pMaxLength;
StringBuilder res = new StringBuilder();
if (len <= pMaxLength) {
return pInputString;
} else {

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ferronrsmith
ferronrsmith / mongo_clean_quiet.sh
Last active August 29, 2015 14:04
Cleans mongo db quietly
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})' --port=27015 test