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
| export type Rational = { | |
| numerator: number; | |
| denominator: number; | |
| simplify: () => Rational; | |
| add: (other: Rational) => Rational; | |
| sub: (other: Rational) => Rational; | |
| mul: (other: Rational) => Rational; | |
| div: (other: Rational) => Rational; | |
| valueOf: () => number; | |
| toString: () => 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
| use std::{ | |
| borrow::Borrow, | |
| collections::{BTreeSet, HashMap}, | |
| hash::Hash, | |
| }; | |
| pub struct LFUCache(Lfu<i32, i32>); | |
| // This is the Leetcode API we have to implement | |
| impl LFUCache { |
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
| use std::{ | |
| io::{self, Read, Write}, | |
| net::{TcpListener, TcpStream}, | |
| os::fd::{AsRawFd, RawFd}, | |
| thread, | |
| }; | |
| const READ: libc::c_short = libc::POLLRDNORM; | |
| const WRITE: libc::c_short = libc::POLLWRNORM; |
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
| # Bundler Integration | |
| require "bundler/capistrano" | |
| # Application Settings | |
| set :application, "yourapplicationname" | |
| set :user, "serveruser" | |
| set :deploy_to, "/home/#{user}/rails-applications/#{application}" | |
| set :rails_env, "production" | |
| set :use_sudo, false | |
| set :keep_releases, 3 |
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
| set -g default-terminal "screen-256color" | |
| set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
| set-option -sa terminal-overrides ",xterm*:Tc" | |
| set -s escape-time 10 | |
| setw -g xterm-keys on | |
| set -g mouse on | |
| setw -g mode-keys vi | |
| unbind -n -Tcopy-mode-vi MouseDragEnd1Pane | |
| set -g base-index 1 |
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
| import { | |
| any, | |
| char, | |
| delimited, | |
| int, | |
| many0, | |
| map, | |
| multispace0, | |
| nat, | |
| parse, |
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 "set" | |
| class Sig | |
| def initialize(&computation) | |
| @observers = Set.new | |
| @dependencies = Set.new | |
| @computation = computation || proc { nil } | |
| compute if block_given? | |
| 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
| use std::ops::{Div, Sub}; | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | |
| pub enum Month { | |
| Jan = 1, | |
| Feb = 2, | |
| Mar = 3, | |
| Apr = 4, | |
| Mai = 5, | |
| Jun = 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
| var redis = require("redis") | |
| , subscriber = redis.createClient() | |
| , publisher = redis.createClient(); | |
| subscriber.on("message", function(channel, message) { | |
| console.log("Message '" + message + "' on channel '" + channel + "' arrived!") | |
| }); | |
| subscriber.subscribe("test"); |
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
| var fs = require("fs"), | |
| readline = require("readline"); | |
| var reader = readline.createInterface({ | |
| input: fs.createReadStream("large-file.txt"), | |
| output: fs.createWriteStream("/dev/null"), | |
| terminal: false | |
| }); | |
| reader.on("line", function(line) { |
NewerOlder