Skip to content

Instantly share code, notes, and snippets.


Paul leeyspaul

  • San Francisco, CA
View GitHub Profile
leeyspaul /
Last active Jul 31, 2018
Final project v1. (Inspiration from babi_rnn by Keras team - Taken from Jupyter Notebook)
import os
import numpy as np
import pandas as pd
from keras.preprocessing.text import text_to_word_sequence, Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential, Model
from keras.layers import Dense, Flatten, Embedding, Input, Concatenate, Add, RepeatVector, RNN, LSTM, Dot, Dropout
from keras.optimizers import Adam, SGD
from keras.metrics import categorical_accuracy
from itertools import chain
leeyspaul /
Created Jul 31, 2018
Generate .txt file to raw corpus (Code snippet)
def txt_to_raw(file_name):
take in a file_name and then return a raw String corpus of the contained text
with open(file_name, 'r') as file:
raw_corpus = file.readlines()
return raw_corpus
task_training_corpus = txt_to_raw(task_training)
task_testing_corpus = txt_to_raw(task_testing)
leeyspaul /
Created Jul 31, 2018
Unique Vocab Generator for Facebook bABI Project (Snippet - Missing other parts)
def get_unique_vocab(file_name):
with open(file_name,'r') as file:
raw_corpus =
tokenized = text_to_word_sequence(raw_corpus, filters='\n\t?123456789101112131415.')
return set(tokenized + ['.'])
vocab = get_unique_vocab(task_training)
print(f'Vocabulary set\n---\n {vocab}')
leeyspaul / cDecipher.kt
Created Jul 31, 2018
Caeser Decipher in Kotlin
View cDecipher.kt
// Top level declaration of the alphabet array
val alphabet = arrayOf('a',
leeyspaul /
Last active Mar 10, 2021
Codewars Challenge: "Remove the Minimum" by user:bkaes (

My solution

function removeSmallest(numbers) {
  // First step is to remove the smallest value given array
  // Filter the smallest number out with Math.min.apply
  let smallestNumber = Math.min.apply(Math,numbers);
  // Now remove the number from the array 
  // Find the index of smallest number
leeyspaul /
Created Nov 18, 2016 — forked from gschema/
Basic JavaScript MVC Implementation

Basic JavaScript MVC Implementation

Despite being derived from classical MVC pattern JavaScript and the environment it runs in makes Javascript MVC implementation have its own twists. Lets see how typical web MVC functions and then dive into simple, concrete JavaScript MVC implementation.

How Web MVC typically works

Typical server-side MVC implementation has one MVC stack layered behind the singe point of entry. This single point of entry means that all HTTP requests, e.g. or etc., are routed, by a server configuration, through one point or, to be bold, one file, e.g. index.php.

At that point, there would be an implementation of Front Controller pattern which analyzes HTTP request (URI at first place) and based on it decides which class (Controller) and its method (Action) are to be invoked as a response to the request (method is name for function and member is name for a variable when part of the class/object).

leeyspaul / Looping Triangle
Created Feb 23, 2016
JavaScript Looping Triangle Exercise
View Looping Triangle
for ( var y = "#"; y.length <= 7; y += "#" ) {