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
server { | |
listen 80; | |
server_name www.demoit.io; | |
underscores_in_headers on; | |
listen 443 ssl; | |
client_max_body_size 500M; | |
ssl_certificate /etc/nginx/ssl/api_demoit_io.crt; | |
ssl_certificate_key /etc/nginx/ssl/api_demoit_io.key; | |
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
defmodule Preso do | |
# shows what was passed in and then evals it and shoves the | |
# lhs back into the current context | |
defmacro show(stuff) do | |
{op, _, [{lhs,_, _}, rhs]} = stuff | |
IO.write "#{IO.ANSI.blue}#{IO.ANSI.bright}" | |
IO.write "#{lhs} #{op} " | |
IO.inspect rhs | |
IO.puts "#{IO.ANSI.reset}" | |
quote do |
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
defmodule Die do | |
def init(), do: :random.seed(:erlang.now) | |
def d6(), do: :random.uniform(6) | |
def d100(), do: :random.uniform(100) | |
end | |
defmodule War do | |
def create_player(name, skill, hp) do | |
[ name: name, skill: skill, hp: hp ] | |
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
;; Die Roll stuff | |
(defn die-roll [numSides] | |
(int (+ 1 (rand numSides)))) | |
(defn d4 [] | |
(die-roll 4)) | |
(defn d6 [] | |
(die-roll 6)) |
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
USING: kernel random math accessors sequences prettyprint io ; | |
USING: io.encodings.binary io.files serialize math.parser ; | |
IN: examples.war | |
TUPLE: player name hitpoints acc ; | |
! We're starting w/ Two sample players on the stack | |
! The rule is to always keep them there | |
"Urg" 20 70 player boa | |
"Conan" 25 65 player boa | |
! "Gwent" 18 95 player boa |
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
% Monkey problem in Prolog -- Taken from PPAI | |
% Before reading this code: http://www.youtube.com/watch?v=WnlIWpZSPXU | |
% | |
% First up is the move to the final spot we want | |
move(state(middle, onbox, middle, hasnot), %Before | |
grasp, %Action | |
state(middle, onbox, middle, has)). %After -- monkey wins motherfucker! | |
% Action climb |
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" | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
"strings" | |
"github.com/PuerkitoBio/goquery" |
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" | |
"math/rand" | |
"fmt" | |
"strconv" | |
) | |
func randInt(min int, max int) int { |
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
% Here's our set of users | |
% Mind you, fred has no access_levels, he's a user | |
% but he can't even logon | |
user(jon). | |
user(mary). | |
user(ed). | |
user(fred). | |
% access_level(rankNumber, name, create, read, modify) |
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
% str(ulf, 19). | |
% intell(ulf, 12). | |
% dex(ulf, 10). | |
%str(gar, 12). | |
%intell(gar, 18). | |
%dex(gar, 13). | |
% calc_stats(X,N):- | |
% str(X,Y), |