Skip to content

Instantly share code, notes, and snippets.

@larryprice
larryprice / lcs.rb
Last active August 29, 2015 14:17
Longest Common Substring
#!/usr/bin/env ruby
def common?(strings, substring)
strings.each do |s|
return false if !s.include? substring
end
true
end
def possible_sequences(anchor, sequenceLength)
@larryprice
larryprice / twitter_handle_generator.py
Created November 1, 2014 22:22
Daily Programmer Challenge #185
# https://www.reddit.com/r/dailyprogrammer/comments/2jt4cx/10202014_challenge_185_easy_generated_twitter/
import re
p = re.compile('^at')
modified = []
f = open('enable1.txt', 'r')
@larryprice
larryprice / web_steps.rb
Created August 7, 2014 11:45
web_steps.rb
# Taken from the cucumber-rails project.
require 'uri'
require 'cgi'
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
module WithinHelpers
def with_scope(locator)
locator ? within(locator) { yield } : yield
end
@larryprice
larryprice / client.js
Created July 14, 2014 12:02
Modified Trello client.js for use on Ollert
!function(){var b,c,d,e,f,g,a={version:1,apiEndpoint:"https://api.trello.com",authEndpoint:"https://trello.com"},h=[].slice;g=function(a,b,g){var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;for(n=g.key,s=g.token,j=g.apiEndpoint,k=g.authEndpoint,t=g.version,m=""+j+"/"+t+"/",p=a.location,i={clearReady:function(){e={}},version:function(){return t},key:function(){return n},setKey:function(a){n=a},token:function(){return s},setToken:function(a){s=a},rest:function(){var a,c,d,e;return c=arguments[0],a=2<=arguments.length?h.call(arguments,1):[],e=q(a),d=e[0],a=e[1],g={url:""+m+d,type:c,data:{},dataType:"json",success:e[2],error:e[3]},b.support.cors||(g.dataType="jsonp","GET"!==c&&(g.type="GET",b.extend(g.data,{_method:c}))),n&&(g.data.key=n),s&&(g.data.token=s),null!=a&&b.extend(g.data,a),b.ajax(g)},authorized:function(){return null!=s},deauthorize:function(){s=null,u("token",s)},authorize:function(c){var d,e,h,i,j;if(g=b.extend(!0,{type:"redirect",persist:!0,interactive:!0,scope:{read:!0,write:!1,account:!1},expiration:"30da
@larryprice
larryprice / golangTour.go
Last active September 11, 2017 18:22
golang tour exercise solutions
// http://tour.golang.org/
/*
Slide 24: Loops and Functions
*/
package main
import (
"fmt"
"math"