This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://tour.golang.org/ | |
/* | |
Slide 24: Loops and Functions | |
*/ | |
package main | |
import ( | |
"fmt" | |
"math" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.4 | |
# install gpm | |
RUN git clone https://github.com/pote/gpm.git /tmp/gpm | |
WORKDIR /tmp/gpm | |
RUN ./configure && make install | |
# sets the working directory to the application source for convenience | |
ADD . /go/src/github.com/larryprice/myapp | |
WORKDIR /go/src/github.com/larryprice/myapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="content" style="margin-bottom: 1.5em;">Welcome</div> | |
<button id="continue" onclick="nextPage()"> | |
Continue | |
</button> | |
<script type="text/javascript" async> | |
function nextPage() { | |
var content = document.getElementById("content"), | |
nextPage = 1; | |
if (content.innerHTML === "Welcome") { | |
updatePageContent(nextPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = {}; | |
_.debounce = function (func, wait, immediate) { | |
var timeout, start, that, args; | |
var later = function () { | |
if (Date.now() - start >= wait && !immediate) { | |
func.apply(that, args); | |
timeout = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (process.argv.length !== 3) { | |
console.log("Usage:", process.argv[1], "num") | |
return; | |
} | |
var primeNum = parseInt(process.argv[2]); | |
if (isNaN(primeNum)) { | |
console.log("is not even a number, let alone prime"); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (process.argv.length !== 3) { | |
console.log("Usage:", process.argv[1], "num") | |
return; | |
} | |
var garland = function (word) { | |
var degree = 0; | |
for (var i = 1; i < word.length; ++i) { | |
var front = word.slice(0, i); | |
for (var j = 1; j <= i; ++j) { |
OlderNewer