Skip to content

Instantly share code, notes, and snippets.

View jeremydouglass's full-sized avatar

Jeremy Douglass jeremydouglass

View GitHub Profile
@cardil
cardil / JEP.md
Last active April 24, 2024 00:34
[Draft] JEP - Change name of imported type (aliasing)

Summary

Change name of imported type (aliasing)

Goals

The goal is to make code more productive and clean in cases where multiple classes with same name must be used in code. It should relief a developers frustration in that

@genekogan
genekogan / ascii-art-rnn
Created August 18, 2018 16:23
generated text from an LSTM (char-rnn-tensorflow) trained on ascii art scraped from https://www.asciiart.eu/
This file has been truncated, but you can view the full file.
.:'
..:'
.;'
.;!;
.;;;;,;;,;;,,,.
.,;;;'''''';;..,;;;,;
`'',CC;;;;;;'.....;;;.
:.............,'`...;;;;;;;.............;;\. ::::::::::
;;;;;;..,,,...,,..........;' :::::::::::;;;;;;;;;'..
:::::::::::' :: `'':::::......,,,;::::::::::::::::'
@monkstone
monkstone / data.yml
Last active November 27, 2017 21:22
Reading and Writing YAML with jruby-complete.jar
---
bubbles:
- xpos: 20
ypos: 50
diameter: 200
emotion: happy
- xpos: 80
ypos: 60
diameter: 210
emotion: sad
@g-io
g-io / Vividict.py
Last active May 10, 2018 12:31
Python autovivified nested dictionary
class Vividict(dict):
"""
dict class which allows to set deeply nested values. Any nested dict will get autovivified.
Note that using defaultdict is more performant, so in case of huge datasets revert to that one.
However using this class and not 'closing' it after setting values might result in undesired behavior:
When accessing a value which is not set, no KeyError is thrown, instead it's autovivified into an empty Vividict.
To guarantee this doesn't happen but KeyError is thrown, dictify() needs to be called to transform the data structure
into regular dicts.
@wesleybliss
wesleybliss / docker-compose-node-mongo.yml
Created September 9, 2016 21:37
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
@jnwhiteh
jnwhiteh / Array.java
Created January 6, 2016 22:15
An example of implementing Iterable and Iterator in Java
import java.util.Iterator;
import java.util.NoSuchElementException;
// Introduction:
//
// This is an example class meant to illustrate several differen concepts:
// * The use of type parameters (i.e. Java generics)
// * Implementing an iterator over some collection, in this case an array
// * Implementing the Iterable interface, which enables your collection
// to work with the Java simple for loops, i.e. (for String s : list)
@gornostal
gornostal / Unicode.md
Created November 22, 2015 10:15
Python 2.7. Unicode Errors Simply Explained

Python 2.7. Unicode Errors Simply Explained

I know I'm late with this article for about 5 years or so, but people are still using Python 2.x, so this subject is relevant I think.

Some facts first:

  • Unicode is an international encoding standard for use with different languages and scripts
  • In python-2.x, there are two types that deal with text.
    1. str is an 8-bit string.
  1. unicode is for strings of unicode code points.
@atduskgreg
atduskgreg / PWindow.pde
Last active November 15, 2023 13:29
Example of creating a Processing sketch with multiple windows (works in Processing 3.0)
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
void settings() {
size(500, 200);
}
@shenwei356
shenwei356 / nested_dict.py
Created November 3, 2015 06:50
different implemention of nested dict in Python
#!/usr/bin/env python
# different implemention of nested dict in Python
from collections import defaultdict
# from: http://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python
class AutoVivification(dict):
def __getitem__(self, item):
try:
return dict.__getitem__(self, item)
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes: