Skip to content

Instantly share code, notes, and snippets.

View plukevdh's full-sized avatar
🔥

Luke van der Hoeven plukevdh

🔥
View GitHub Profile
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@yusugomori
yusugomori / bpnn.coffee
Created January 25, 2013 17:10
Back-Propagation Neural Networks by CoffeeScript
###!
*
* Back-Propagation Neural Networks
*
* References:
* http://arctrix.com/nas/python/bpnn.py
*
###
class BPNN
@plukevdh
plukevdh / leven.ex
Created November 28, 2012 18:17
Levenshtein in elixir
defmodule Levenshtein do
def first_letter_check(one_letter, two_letter) do
case one_letter == two_letter do
true -> 0
false -> 1
end
end
def distance(string_1, string_1), do: 0
def distance(string, ''), do: :string.len(string)
@plukevdh
plukevdh / levenshtein.erl
Created November 7, 2012 05:15
memoized levenshtein
-module(levenshtein).
-export([distance/2]).
store_result(Key, Value, Cache) ->
{Value, dict:store(Key, Value, Cache)}.
distance(String1, String2) ->
{List,_} = distance(String1, String2, dict:new()),
List.
@plukevdh
plukevdh / levenshtein.erl
Created November 7, 2012 03:13
Implementations of the levenshtein algorithm
-module(levenshtein).
-export([distance/2]).
first_letter_check(OneLetter, TwoLetter) ->
if OneLetter =:= TwoLetter -> 0
; true -> 1
end.
distance(String1, String1) -> 0;
distance(String, "") -> string:len(String);
@sowawa
sowawa / sinachiku.rb
Created June 18, 2012 07:00 — forked from mattn/sinachiku.rb
sinatra on mruby
require 'HTTP'
require 'UV'
module Sinachiku
@routes = { 'GET' => [], 'POST' => [] }
def self.route(method, path, opts, &block)
@routes[method] << [path, opts, block]
end
def self.do(r)
@routes[r.method].each {|path|
@jbjornson
jbjornson / SwitchToFile.py
Last active October 29, 2015 19:45
Show a input panel to switch to a currently open file
import sublime_plugin
import os
# -------------------------------------------
# You will need to create a key mapping for this, something like:
# { "keys": ["alt+e"], "command": "switch_to_file" }
# -------------------------------------------
class SwitchToFileCommand(sublime_plugin.WindowCommand):
def run(self):
self.display_list = []
self.views = []
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@plukevdh
plukevdh / hold_music.rb
Created June 23, 2011 21:49
Replicating functionality of the hold music "twimlet" from Twilio (http://labs.twilio.com/twimlets/holdmusic)
require 'httparty'
require 'twilio'
module Twimlet
module HoldMusic
include HTTParty
AWS_URL = "s3.amazonaws.com"
def generate_playlist(bukkit='com.twilio.music.classical', options={})
@bucket = "http://#{bukkit}.#{AWS_URL}"