This file contains hidden or 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
require_relative 'nim.rb' | |
nim = Nim.new | |
print "Please select board configuration: (0: [4,3,7], 1: [1,3,5,7]): " | |
choice = Integer(gets.chomp) rescue nil | |
while !(choice.match(/0|1/)) | |
puts "Invalid input" | |
puts "Please select board configuration: (0: [4,3,7], 1: [1,3,5,7]): " | |
choice = Integer(gets.chomp) rescue nil | |
end |
This file contains hidden or 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/perl | |
use warnings; | |
use strict; | |
my $board = 12; | |
sub board($) { | |
print "There are $board board pieces left.\n"; | |
print "\n".$_[0]." Wins!\n\n" if($board <= 0); | |
} | |
sub take($$) { | |
my ($p,$t) = @_; |
This file contains hidden or 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
$(document).scroll(function(e){ | |
var $window = $(window) | |
var $authors = $('.author') | |
if($authors.length > 0) { | |
$authors.each(function(i, e) { | |
var $author = $(e) | |
var $container = $author.parent().parent() | |
var offset = Math.max(0, $window.scrollTop() - $container.offset().top + 50) | |
offset = Math.min($container.height() + $container.offset().top - $author.outerHeight() - 50, offset) |
This file contains hidden or 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/perl | |
use warnings; | |
use strict; | |
my $rounds = 1000; | |
my $wins; | |
my @initialDoors = (0..100); | |
for(my $round = 0; $round < $rounds; $round++) { | |
my @doors = @initialDoors; | |
for my $door (@doors) { $door = 0; } | |
my $choice = int rand @doors; |
This file contains hidden or 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 particle_module() | |
local particles, particle_default = | |
{}, { position = {0,0}, decay = .5, color = 7, size = 4 } | |
return { | |
add = function(particle) | |
for k,v in pairs(particle_default) do particle[k] = particle[k] or v end | |
if particle.jitter then | |
particle.position[1] += rnd()*particle.jitter-particle.jitter/2 | |
particle.position[2] += rnd()*particle.jitter-particle.jitter/2 | |
end |
This file contains hidden or 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
package main | |
import ( | |
"time" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"os/exec" | |
"strings" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println(i_to_base64(500)) | |
} | |
func i_to_base64(num int) string { |
This file contains hidden or 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
doctype html | |
html | |
head | |
link(rel='stylesheet' href='/css/main.css') | |
script(src='/js/main.js') | |
body | |
div(uk-sticky="sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky") | |
nav.uk-navbar-container(uk-navbar) | |
.uk-navbar-center | |
ul.uk-navbar-nav |
This file contains hidden or 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/perl | |
use warnings; | |
use strict; | |
use Caaz::Prompt; | |
if($ARGV[0]) { | |
my (@lines, %map); | |
open FILE, "<$ARGV[0]"; | |
chomp(@lines = <FILE>); | |
close FILE; |