Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View llytvynenko's full-sized avatar

Leonid Lytvynenko llytvynenko

View GitHub Profile
@llytvynenko
llytvynenko / index.md
Created March 22, 2018 10:47 — forked from mathisonian/index.md
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@llytvynenko
llytvynenko / min-char-rnn.py
Created January 6, 2017 13:29 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
class CreateTheme
{
public int Id;
public int AccountId;
public string Name;
public Optional<string> Description;
}
static void Handle(IUnitOfWork uow, CreateTheme cmd)
{
// typeclass
type Showable<'a> = { show : 'a -> unit; showPretty : 'a -> unit } //'
// instances
let IntShowable =
{ show = printfn "%d"; showPretty = (fun i -> printfn "pretty %d" i) }
let StringShowable =
{ show = printfn "%s"; showPretty = (fun s -> printfn "<<%s>>" s) }
// function using typeclass constraint
public void Main()
{
//Stream class: http://msdn.microsoft.com/en-us/library/system.io.stream(v=vs.110).aspx
using (FileStream config = File.Open("some.config", FileMode.Open))
using (FileStream otherConfig = File.Open("other.config", FileMode.Open))
{
CallLibrary(config, otherConfig);
}
}