Skip to content

Instantly share code, notes, and snippets.

@cevaris
cevaris / pbsort
Created August 17, 2015 16:29
pbsort - sort your clibpoard
# Sort what is in my clipboard
alias pbsort='pbpaste | sort | pbcopy'
package com.nam.thrift.integration;
import junit.framework.TestCase;
import org.apache.thrift.TProcessor;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;
import java.net.ServerSocket;
@cevaris
cevaris / foldRight.scala
Created May 25, 2015 22:06
Scala List.foldRight example
scala> (0 until 10).foldRight(1)((a, z) => {println(s"$a,$z"); a})
9,1
8,9
7,8
6,7
5,6
4,5
3,4
2,3
1,2
@cevaris
cevaris / rvm_init.sh
Last active August 29, 2015 14:19
RVM project init script which creates the appropriate .ruby-version .ruby-gemset files
#!/usr/bin/env zsh
# or #!/usr/bin/env bash
function rvm_init(){
RVM_VERSION=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
RVM_GEMSET=$(basename $(PWD))
for i in "$@"
do
@cevaris
cevaris / jira-block-short.js
Created April 7, 2015 19:07
Block Jira Editor Shortcuts
// Here You can type your custom JavaScript...
// Get a list of elements on the page.
var x = document.getElementsByTagName("*");
// Go through each element and check for the accessKey property.
// Obliterate it if found.
for (var i = 0; i < x.length; i++)
{
if(x[i].accessKey)
{
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
@cevaris
cevaris / .emacs
Created March 13, 2015 03:39
Setup spell checking in Emacs on Mac OS X
;; ispell
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(setq ispell-program-name "/usr/local/Cellar/ispell/3.3.02/bin/ispell")
@cevaris
cevaris / samplf.sh
Created March 11, 2015 14:58
Naive sampling of file for bash/zsh
# Sample file
samplef() {
# set -x
if [ -z "${1}" ]; then
echo 'Error: Missing file path'
echo
echo 'Usage:'
echo 'samplef <FILEPATH> <SAMPLE_SIZE>'
echo
echo 'Optional paramters: <SAMPLE_SIZE>, default is 0.1'
@cevaris
cevaris / float.go
Created March 9, 2015 14:09
Golang float64 equality esitimation
var EPSILON float64 = 0.00000001
func floatEquals(a, b float64) bool {
if ((a - b) < EPSILON && (b - a) < EPSILON) {
return true
}
return false
}
@cevaris
cevaris / build.sh
Created March 8, 2015 22:50
Debugging golang in GDB
go build -gcflags '-N'