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
extern crate sdl2; | |
use sdl2::audio::{AudioCallback, AudioSpecDesired}; | |
use std::sync::{Arc, Mutex}; | |
use std::time::Duration; | |
struct SoundPacket { | |
pitch: f32, | |
len: Option<usize>, | |
volume: f32, |
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
use serde_json::Value; | |
#[derive(Debug)] | |
enum Shovel { | |
Key(&'static str), | |
Index(usize), | |
} | |
fn dig(val: Value, with: &[Shovel]) -> Option<Value> { | |
if with.len() == 0 { |
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
# USAGE: ruby PATH_TO_SCRIPT/translation.rb "TOKEN_TO_TRANSLATE" | |
require 'yaml' | |
LANG = 'en' | |
subject = ARGV[0].split('.') | |
`find . -name '#{LANG}.yml'` | |
.lines | |
.map { |line| YAML.load(IO.read(line.strip))[LANG] } |
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
require 'pp' | |
def run_test | |
make_board = -> { 8.times.map { [0] * 8 } } | |
board = make_board.call | |
return false unless ok?(board) | |
board = make_board.call | |
board[0][0] = 1 |
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
#include <iostream> | |
#include <string> | |
#include <utility> | |
#include <vector> | |
#include <regex> | |
#include <unordered_map> | |
#include <cmath> | |
using namespace std; | |
using value_t = double; |
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
import Data.Char | |
data VM = VM { | |
mem :: [Int], | |
ptr :: Int | |
} | |
tPlus = '+' | |
tMinus = '-' | |
tDot = '.' |
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
package main | |
import "gopkg.in/resty.v1" | |
import "fmt" | |
import "log" | |
import "strconv" | |
import "sync" | |
func main() { | |
var wg sync.WaitGroup |
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
require 'pp' | |
class RuleOption | |
attr_accessor :parts | |
def initialize(*parts) | |
@parts = parts | |
end | |
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
-- Custom data types | |
data Value = ValueString String | ValueInt Int | ValueJson Json deriving (Show) | |
data KeyValuePair = KeyValuePair String Value deriving (Show) | |
data Json = JsonObject [KeyValuePair] | JsonArray [Value] deriving (Show) | |
-- Decoder | |
decode :: String -> Value | |
decode raw = v |
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
## CONSTS ##################################################################### | |
PERSON_NUM = 32 | |
# Number of meeting iterations. | |
ITERATION = 64 | |
## METHODS #################################################################### | |
# Generates start-state meetings with the number of iterations | |
def generate_old_meetings |