View parse_json.hs
-- 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
View match_search.rb
## CONSTS #####################################################################
PERSON_NUM = 32
# Number of meeting iterations.
ITERATION = 64
## METHODS ####################################################################
# Generates start-state meetings with the number of iterations
def generate_old_meetings
View rubik.rb
require 'pp'
class Cube
attr_accessor :cells
def initialize
@cells = {
top: [0] * 9,
front: [1] * 9,
left: [2] * 9,
View add_frozen_heading.rb
# Call: ruby add_frozen_heading.rb PATH_TO_FOLDER
dir = ARGV[0] || ''
if !Dir.exist?(dir)
puts 'Missing folder.'
exit
end
def check_headers(dir)
# puts "Inspect #{dir}"
View ruby_prof_diff.rb
require 'pp'
require 'ostruct'
require 'cgi'
class CallChild
attr_accessor(
:file,
:method,
:callee_called,
:callee_line,
View diff_inverter.cpp
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main(int argc, char* argv[]) {
ifstream file(argv[1]);
string s;
View mod_timing.c
#include "httpd.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_request.h"
#include <time.h>
#include <syslog.h>
/**
* Definitions.
View ttymindmap.rb
# Usage:
# - Start new mindmap:
# `ruby ttymindmap.rb`
# - Open Freemind format MM mindmap:
# `ruby ttymindmap.rb <PATH-TO-MM-FILE>`
#
# Press `h` key when running for help.
require 'nokogiri'
View maze.rb
EMPTY = 0x0
UP = 0x1
RIGHT = 0x2
DOWN = 0x4
LEFT = 0x8
# Maze generator class.
class Generator
def initialize(w, h)
View json_concurrent.rs
use std::collections::HashMap;
use std::thread::{self, sleep};
use std::time;
use std::sync::{mpsc, Arc};
macro_rules! char_token {
($c:expr, $t:ident) => ({
let mut value = String::new();
value.push($c);
Some(Token{ttype: TokenType::$t, value:value})