As configured in my dotfiles.
start new:
tmux
start new with session name:
import itertools | |
import argparse | |
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
class Card: | |
def __init__(self, symbols): | |
self.symbols = frozenset(symbols) | |
self.name = "".join(symbols) |
def load_modules(package): | |
for importer, name, is_package in pkgutil.iter_modules([package]): | |
fullname = package + '.' + name | |
if not is_package: | |
loader = importer.find_module(fullname) | |
yield loader.load_module(fullname) |
typedef struct { | |
string name; | |
node* next; | |
} node; | |
node* first = null; | |
void append(string name) { | |
new_node = new linked_list { | |
name = name, |
// Store a deck in a bit array by the following algorithm: | |
// value := pick[0]; | |
// value = value * 51 + second pick | |
// value = value * 50 + third pick | |
// .. | |
// value = value * 1 + 52nd pick | |
// The first pick is pick[0] | |
BigInt StoreDeck(params int[] picks) { | |
BigInt value = pick[0]; | |
for(int i = 1; i < picks.Length; i++) { |
As configured in my dotfiles.
start new:
tmux
start new with session name:
using System.Web; | |
using BBCom.Gotham.Domain; | |
using BBCom.Gotham.Service; | |
using GothamMVC3.Helpers; | |
using GothamMVC3.Navigation; | |
using Ninject; | |
using Ninject.Modules; | |
using Ninject.Web.Common; | |
using Ninject.Extensions.Conventions; | |
using Telerik.Web.Mvc; |
public class Program | |
{ | |
public static void Main() | |
{ | |
// Register | |
using(var kernel = ConfigureKernel()) | |
{ | |
// Resolve | |
var program = kernel.Get<Program>(); | |
program.Run(); |
public class GenerateAndCountCalculator : IMandelbrotCalculator | |
{ | |
public int CalculatePoint(Complex c, int maxIterations) | |
{ | |
return Generate(Complex.Zero, z => (z * z) + c) | |
.TakeWhile(z => z.Magnitude <= 2) | |
.Take(maxIterations) | |
.Count(); | |
} | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Numerics; | |
using System.Text; | |
namespace ConsoleApplication4 | |
{ | |
public static class BigIntegerExtensions | |
{ |
// This is really elegant with methods, but really, really ugly with query expression | |
public IQueryable<User> SearchUsers(string firstName, string lastName) | |
{ | |
var query = getUserQuery(); | |
if(!string.IsNullOrEmpty(firstName)) | |
query = query.Where(user => user.FirstName == firstName); | |
if(!string.IsNullOrEmpty(lastName)) | |
query = query.Where(user => user.LastName == lastName); |