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
export type FetchSuccess = { response?: Response } & { responseObject?: JsonObject }; | |
export type FetchError = FetchSuccess & { | |
errors: ReadonlyArray<object | string>; | |
} | |
export const post = ( | |
url: string, | |
body: object, | |
) => { |
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
1. oh-my-zsh (`$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh`) | |
2. Homebrew (`$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"`) | |
3. gitsomepizza ZSH theme. (https://github.com/jacksonGariety/gitsomepizza) | |
4. Emacs 24 (`$ brew install Emacs`) | |
5. [TotalSpaces 2](http://totalspaces.binaryage.com) | |
- Fastest space switching |
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
;; 1 | |
;; 1 1 | |
;; 1 2 1 | |
;; 1 3 3 1 | |
;; 1 4 6 4 1 | |
;; pascal's triangle | |
(define (pascals-triangle h) | |
;; row iterator | |
(define (gen-row row) |
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
type LoginForm struct { | |
utils.Flash | |
Username string | |
Password string | |
} | |
func (form *LoginForm) Validate() bool { | |
form.Errors = make(map[string]string) | |
if strings.TrimSpace(form.Password) == "" { |
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 | |
import Debug.Trace | |
data Expr = Nil | Phrase String | Not Expr | And Expr Expr | Or Expr Expr | |
deriving (Show, Eq) | |
dne :: Expr -> Expr | |
dne (Not (Not p)) = p | |
dne _ = Nil |
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
partitionAll :: Int -> Int -> [a] -> [[a]] | |
partitionAll _ _ [] = [] | |
partitionAll w s xs = (take w xs) : partitionAll w s (drop s xs) | |
largestProductInSeries :: Int -> [Int] -> Int | |
largestProductInSeries l xs = maximum $ map (product) $ partitionAll l 1 xs | |
main = do | |
f <- readFile "008.txt" | |
let s = filter isDigit 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.List | |
main = print $ largestPalindrome 3 | |
isPalindrome :: Integer -> Bool | |
isPalindrome n = | |
let s = show n | |
in reverse s == s | |
largestPalindrome :: Integer -> Integer |
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
;;; Nudity | |
(setq visible-bell t) ; disable visual beep | |
(transient-mark-mode t) ; show region, drop mark | |
(global-font-lock-mode t) ; for all buffers | |
(global-visual-line-mode t) ; word-wrap | |
(show-paren-mode t) ; show matching parentheses | |
(setq initial-scratch-message "") | |
(setq inhibit-startup-screen t) | |
;; Packages |
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 'babel-polyfill' | |
import Koa from 'koa' | |
const app = new Koa(); | |
function* fibonacci () { | |
let [a, b] = [0, 1] | |
while (true) { | |
[a, b] = [b, a + b] | |
yield a | |
} |
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
(define (stuff-peak a ls) | |
(let loop ((pair ls)) | |
(display pair) | |
(newline) | |
(cond ((lat? pair) (begin (set! pair a) | |
ls)) | |
(else (loop (car pair)))))))) |
NewerOlder