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 qualified Data.Map as Map | |
data Formula = Variable String | |
| Negation Formula | |
| Conjunction Formula Formula | |
| Disjunction Formula Formula | |
instance Show Formula where | |
show (Variable v) = v | |
show (Negation f) = "!" ++ show f |
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.Maybe (fromMaybe) | |
class Fluffy f where | |
furry :: (a -> b) -> f a -> f b | |
-- Exercise 1 | |
-- Relative Difficulty: 1 | |
instance Fluffy [] where | |
furry = map |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("www.weibo.com") { | |
#v6_pl_content_publishertop { | |
display: none | |
} | |
#v6_pl_content_homefeed .WB_tab_a { | |
display: none | |
} |
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 std::iter; | |
fn primes(maxn: uint) -> (Vec<bool>, Vec<uint>) { | |
let mut primes : Vec<uint> = Vec::new(); | |
let mut is_prime : Vec<bool> = Vec::from_elem(maxn + 1, true); | |
*is_prime.get_mut(0) = false; | |
*is_prime.get_mut(1) = false; | |
primes.push(2); | |
for i in iter::range_step_inclusive(4, maxn, 2) { | |
*is_prime.get_mut(i) = 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
#!/bin/env python | |
''' L-BFGS algorithm http://aria42.com/blog/2014/12/understanding-lbfgs/ ''' | |
import numpy as np | |
from numpy import linalg | |
from collections import deque | |
class LineSearch: | |
''' backtracing line search algorithm ''' |
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
var buttons = require('sdk/ui/button/action'); | |
var tabs = require("sdk/tabs"); | |
var prefs = require('sdk/simple-prefs'); | |
var Request = require("sdk/request").Request; | |
var button = buttons.ActionButton({ | |
id: "delicious-check", | |
label: "delicious-check", | |
icon: "./tagOff.png", | |
onClick: check |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pyautogui | |
# constants | |
O, R, B = -1, 1, 0 | |
width = 50 | |
# global variables | |
topy, topx = None, None | |
mat = [] |
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
# coding: utf8 | |
from Foundation import * | |
from AppKit import * | |
from PyObjCTools import AppHelper | |
import os | |
import re | |
start_time = NSDate.date() | |
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
calling tramp_fac(n=5, k=1) | |
bouncer: ('bounce', 'tramp_fac', (4, 5)) | |
calling tramp_fac(n=4, k=5) | |
bouncer: ('bounce', 'tramp_fac', (3, 20)) | |
calling tramp_fac(n=3, k=20) | |
bouncer: ('bounce', 'tramp_fac', (2, 60)) | |
calling tramp_fac(n=2, k=60) | |
bouncer: ('bounce', 'tramp_fac', (1, 120)) | |
calling tramp_fac(n=1, k=120) | |
bouncer: ('bounce', 'tramp_fac', (0, 120)) |