Skip to content

Instantly share code, notes, and snippets.

View radeinla's full-sized avatar

Reginald D. (Red) radeinla

View GitHub Profile
@radeinla
radeinla / roman_numerals_up_to_1k.py
Created January 20, 2019 17:41
Numerals to Roman Numerals
MAPPING = [None]
RAW = ['I', 'V', 'X', 'L', 'C', 'D', 'M']
n = 0
last = ''
places = [1, 2, 3]
for place in places:
MAPPING.append(dict())
SET = RAW[(place-1)*2: ((place-1)*2)+3]
for i in range(1, 10):
if i < 4:
@radeinla
radeinla / cat-portions.ipynb
Last active June 7, 2017 09:59
Cat Portions Calculator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@radeinla
radeinla / format_messages_properties.py
Created March 9, 2017 13:31
Little python script for reformatting and ordering of messages.properties file
def format_long_line(line):
max_length = 120
if len(line) <= max_length:
return line
i = 0
formatted = ""
first = True
while i < len(line):
if not first:
formatted += "\\\n"
@radeinla
radeinla / problem.md
Last active September 15, 2015 11:45
grails 2.5.1 upgrade problem: external configs

We are not able to load external configs through AWS S3.

On 2.5.1:

                    def resource = resolver.getResource(location.toString())
                    if(resource.exists()) {
                        InputStream stream = null
                        try {
                            stream = resource.getInputStream()
                            if (resource.filename.endsWith('.groovy')) {
@radeinla
radeinla / empty-returns-return-falsies
Created December 22, 2014 07:09
Groovy Empty Return Behaviors
class A {
int b
}
List<A> cool() {
return
}
boolean really() {
return
@radeinla
radeinla / gist:bf796374aaa76c30ff70
Created September 3, 2014 14:56
Stumbled on safari querySelector bug today
1. Go to http://jsfiddle.net/xjgdey0z/
2. Open inspector, you should see the error that should not happen.
@radeinla
radeinla / Weird Groovy Shit
Created June 28, 2013 18:15
Newbie at this but why is this printing only the last value of the for loop and not binding each value of the list in the for loop? My expectation was for the last closure statement: obj1 obj2 obj3 but what is actually happening is: obj3 obj3 obj3
List<Integer> list = [1, 2, 3].collect { new Object() }
list.each { println it }
List<Closure> cls = []
for (Object i : list) {
cls << { ->
println i
}