Skip to content

Instantly share code, notes, and snippets.

@gausby
gausby / binaryToString.js
Created February 18, 2011 20:22
A stupid binary to char converter.
(function(w,r,i){r="",w=w.split(" ");for(i in w){r+=String.fromCharCode(parseInt(w[i],2));};return r;}('1101000 1100101 1101100 1101100 1101111 101100 100000 1110111 1101111 1110010 1101100 1100100'))
@gausby
gausby / stringToBinaryConverter.js
Created February 18, 2011 20:24
A stupid string to binary converter.
(function(w,r,i){r=[];for(i in w)r.push(w.charCodeAt(i).toString(2));return r.join(' ');}('hello, world'))
@gausby
gausby / duckduckgo.el
Created January 30, 2012 13:34
Defines a function that perform a search on DuckDuckGo. The results opens in your default browser. Put it in your emacs init file.
(defun duckduckgo nil
"Duck Duck Go something."
(interactive)
(let (arg)
(if mark-active
(setq arg (buffer-substring (region-beginning) (region-end)))
(setq arg (read-from-minibuffer "Search term: ")))
(browse-url (format "http://duckduckgo.com/?q=%s" arg))))
@gausby
gausby / say.el
Created March 22, 2012 08:45
Speak region or a given input
(defun say nil
"Speak region."
(interactive)
(let (arg)
(if mark-active
(setq arg (buffer-substring (region-beginning) (region-end)))
(setq arg (read-from-minibuffer "Say: ")))
(save-window-excursion
(async-shell-command (format "say \"%s\" &" arg)))))
function encryptROT13 (message) {
var input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
output = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm',
rtn = [],
i
;
for (i in message) {
rtn[i] = output[input.indexOf(message[i])] || message[i];
}
@gausby
gausby / .gitignore
Last active December 14, 2015 08:29
git init ... How I currently start off my personal Node projects. Folder structure: README.md ; /lib/ ; /package.json ; /.jshintrc ; /Gruntfile.js ; /.gitignore ; /test/ ; /test/buster.js ; Discuss! (Files can't be in subdirectories in gists, but every config file, except for the buster.js file, is located in the root of the project--the buster.…
/node_modules/
/docs/
/benchmarks/results.csv
@gausby
gausby / gist:8904594
Created February 9, 2014 19:23
Extending the default Pursuit dictionary with a custom checker function.
// npm install pursuit-core
// npm install pursuit-dictionary
var pursuitCore = require('pursuit-core'),
dictionary = require('pursuit-dictionary')
;
// add a random function to the dictionary
dictionary.random = function() {
return 'Math.random() - 0.5 > 0 ? true : false';
@gausby
gausby / gist:9100301
Last active August 29, 2015 13:56
The fact that I didn't have to consult any manual, or notes, to write this makes me even more excited about Elixir.
(lc suit inlist [:hearts, :spades, :diamonds, :clubs], value inlist [1,2,3,4,5,6,7,8,9,:j,:q,:k,:a], do: {:card, suit, value}) |> Enum.shuffle |> Enum.take 5
@gausby
gausby / bottles.ex
Created June 10, 2014 11:19
Elixir Implementation of 99 Bottles of Beer on the Wall
defmodule Bottles do
@moduledoc """
Will print the lyrics for the song 99 bottles of beer on the wall.
See `Bottles.sing` and `Bottles.create_stream` for usage examples.
"""
@doc """
`Bottles.sing`, given a number, will print the lyrics for that verse.
If it is given a range it will print all the verses between these

Keybase proof

I hereby claim:

  • I am gausby on github.
  • I am gausby (https://keybase.io/gausby) on keybase.
  • I have a public key whose fingerprint is 8019 0DD5 79C9 A125 BC82 AED7 66C8 AE05 B714 6BD0

To claim this, I am signing this object: