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
class Fraction | |
@top | |
@bot | |
# top is the x in (x/n) | |
# bot is the n in (x/n) | |
def initialize top, bot | |
@top = top |
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
String.prototype.shuffle = function () { | |
var a = this.split(""), | |
n = a.length; | |
for(var i = n - 1; i > 0; i--) { | |
var j = Math.floor(Math.random() * (i + 1)); | |
var tmp = a[i]; | |
a[i] = a[j]; | |
a[j] = tmp; |
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
String.prototype.shuffle = function () { | |
var a = this.split(""), | |
n = a.length; | |
for(var i = n - 1; i > 0; i--) { | |
var j = Math.floor(Math.random() * (i + 1)); | |
var tmp = a[i]; | |
a[i] = a[j]; | |
a[j] = tmp; |
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
template <class T> | |
class EventHandler | |
{ | |
vector<void(*)(Event<T>&)> subs; | |
public: | |
EventHandler::EventHandler(); | |
void EventHandler::subscribe(void(*handler)(Event<T>&)); | |
void EventHandler::emit(Event<T> value); | |
}; |
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 Discord = require("discord.js") | |
import fs = require("fs"); | |
import path = require("path"); | |
namespace ISeeEverything { | |
enum LogType { | |
MESSAGE_SENT, | |
MESSAGE_EDITED, | |
MESSAGE_DELETED, | |
USER_JOINED, |
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
const Discord = require('discord.js'); | |
const R = require('ramda'); | |
const bot = new Discord.Client(); | |
const request = require('request'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const mkdirp = require('mkdirp'); | |
const prog = require("commander"); |
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
sudo apt-get remove abiword abiword-common abiword-plugin-grammar abiword-plugin-mathview alacarte bison blueman brltty-x11 catfish espeak exo-utils flex fonts-droid fonts-lyx gcalctool gigolo gimp gimp-data gksu gmusicbrowser gnome-desktop-data gnome-system-tools gnome-time-admin gnumeric gnumeric-common gnumeric-doc gstreamer0.10-gnomevfs gthumb gthumb-data gtk2-engines-pixbuf indicator-application-gtk2 indicator-sound-gtk2 libabiword-2.9 libamd2.2.0 libbabl-0.1-0 libbison-dev libblas3 libcolamd2.7.1 libdigest-crc-perl libexo-1-0 libexo-common libexo-helpers libfl-dev libgarcon-1-0 libgarcon-common libgdome2-0 libgdome2-cpp-smart0c2a libgegl-0.2-0 libgimp2.0 libgksu2-0 libglade2-0 libgnomevfs2-0 libgnomevfs2-common libgnomevfs2-extra libgoffice-0.10-10 libgoffice-0.10-10-common libgsf-1-114 libgsf-1-common libgstreamer-perl libgtk2-notify-perl libgtk2-trayicon-perl libgtkmathview0c2a libgtksourceview2.0-0 libgtksourceview2.0-common libgtkspell0 libido-0.1-0 libintl-perl libjavascriptcoregtk-1.0-0 libjpeg-pr |
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
interface Maybe<T> { | |
isJust: Boolean; | |
isNothing: Boolean; | |
} | |
class Just<T> implements Maybe<T> { | |
constructor(private value: T) { | |
} | |
isJust: true; | |
isNothing: false; |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Network.HTTP | |
import Data.Attoparsec.ByteString.Char8 | |
import Data.Attoparsec.Combinator | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Char8 as C8 | |
import Data.Word | |
import Control.Applicative |
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 concat_map(array $arr, callable $f): array { | |
return array_reduce(array_map(function($k, $v) use ($f) { | |
return $f($k, $v); | |
}, array_keys($arr), $arr), function($acc, $v) { | |
return array_merge($acc, $v); | |
}, []); | |
} |
OlderNewer