Skip to content

Instantly share code, notes, and snippets.

View orakaro's full-sized avatar
🐉
Winter is here

orakaro.targaryen orakaro

🐉
Winter is here
View GitHub Profile
@orakaro
orakaro / introrx.md
Created July 2, 2016 08:58 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@orakaro
orakaro / converter.py
Created October 13, 2015 15:41 — forked from sodastsai/converter.py
Convert CSV to PLIST
#!/usr/bin/env python3
import sys
import csv
import plistlib
import os
csv_file = sys.argv[1]
with open(csv_file, 'r', encoding='utf-8') as f:
result = list(csv.DictReader(f))
@orakaro
orakaro / Cash-flow
Last active August 29, 2015 14:03
Cash-flow
DTVD >>> bhh : 500yen (questionable)
DTVD >>> bhh : 500yen (2014-07-09 16:00:00)
{
"IMAGE_SHIFT" : 30, // or higher to reduce image from 2 side
"IMAGE_MAX_HEIGHT" : 30, // or lower to control the max height
}
@orakaro
orakaro / rainbowstream.sh
Last active August 29, 2015 14:03
Install instruction for rainbowstream
pip install virtualenv # skip if you already have virtualenv
virtualenv venv
source venv/bin/activate # use the brand new virtualenv.
pip install rainbowstream # It may go long here
# Long output here ...
rainbow
# Note: if you are really want to use system's python,
# you can just "sudo pip install rainbowstream" and everything should be fine.
@orakaro
orakaro / curses_interactive_shell.py
Last active April 15, 2022 19:27
Interactive shell with in-line autocomplete by Python Curses
# The MIT License
#
# Copyright (c) 2014 Vu Nhat Minh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@orakaro
orakaro / CustomizedLarapaste.xml
Last active August 29, 2015 13:57
Customized Larapaste
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>VilliMagg</string>
<key>name</key>
<string>Larapaste</string>
<key>settings</key>
<array><dict><key>name</key><string>mon_color</string><key>scope</key><string>mcol_46A609FF</string><key>settings</key><dict><key>background</key><string>#46A609FF</string><key>caret</key><string>#FFFFFFFF</string><key>foreground</key><string>#FFFFFFFF</string></dict></dict>
@orakaro
orakaro / IoC.php
Last active February 7, 2020 18:42
Sample of Inversion Of Control (IoC) and Singleton in PHP
<?php
class IoC {
protected static $registry = array();
protected static $shared = array();
// Register
public static function register($name, Closure $resolve)
{
static::$registry[$name] = $resolve;
@orakaro
orakaro / init_mock.py
Last active December 17, 2015 19:49
Try to create seperate function init_mock
class TestModel(unittest.TestCase):
def setUp(self):
self.order = Order()
def init_mock(self):
ary = dict()
ary["cached_pdf"] = PropertyMock(return_value='StoryTree/tests/fixtures/1.pdf')
ary["backcover"] = mock.Mock(return_value=image)
ary["frontcover"] = mock.Mock(return_value=image)
ary["input_files"] = mock.Mock(return_values=[''])