Skip to content

Instantly share code, notes, and snippets.

View captainalan's full-sized avatar
☺️
slowly building up sites

Alan L. Wong captainalan

☺️
slowly building up sites
View GitHub Profile
@captainalan
captainalan / sample.json
Created May 6, 2019 22:14
Question Format Preview
{ "data":[
{
"question": "Is the earth round?",
"type": "multiple-choice",
"choices": {
"a": "yes",
"b": "no",
"c": "in a sense",
"d": "none of your beeswax"
},
@captainalan
captainalan / practice_2019_04_11.hs
Created April 11, 2019 15:16
Haskell Practice: List Sorted on Second Element of Tuple
{- Write a program which returns a list of sorted tuples based on the
- second element:
- e.g. tuple_list = [ (a, 5), (b, 2), (c, 3), (d, 1), (e, 4) ]
- Output: [d, b, c, e, a]
-}
import Data.Tuple
import Data.List
foo :: (Ord b) => [(a, b)] -> [a]
@captainalan
captainalan / vowel_counter.hs
Created April 1, 2019 20:31
Counting Vowels in Haskell: My First Monadic IO
{- Count the number of vowels in a string -}
-- Is the character a vowel?
isVowel :: Char -> Bool
isVowel x = case x of
'a' -> True
'e' -> True
'i' -> True
'o' -> True
'u' -> True
/* Doing exercises in K&R, 03/17/2019
*
* Write a program `entab` that replaces strings of blanks by the minimum
* number of tabs and blanks to achieve the same spacing. Use the same tab
* stops as for `detab`. When either a tab or a single blank would suffice to
* reach a tab stop, which should be given preference?
*/
#include <stdio.h>
# define TABSTOP 4
@captainalan
captainalan / .emacs
Last active August 21, 2019 19:13
.emacs current setup
;; Unicode
(prefer-coding-system 'utf-8-unix)
;; MELPA Repository
;; ==================
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
@captainalan
captainalan / syntactic_trees_nltk_demo.ipynb
Created May 23, 2018 02:20
Syntactic Trees with Python and NLTK Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.