Skip to content

Instantly share code, notes, and snippets.

View evie404's full-sized avatar

Evelyn Pai evie404

View GitHub Profile
@evie404
evie404 / wtf.rb
Last active December 16, 2017 00:26
wtf
# frozen_string_literal: true
module FooFile
class Processor
def self.from_file(file)
new(File.read(file))
end
def initialize(raw)
@raw = raw
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-localhost
namespace: cluster-tests
spec:
containers:
- name: liveness
go
build-essentials
mercuial
docker
etcd
@evie404
evie404 / server.py
Last active September 14, 2016 00:07 — forked from ibeex/foo.log
Flask logging example
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
app = Flask(__name__)
@app.route('/')
def foo():
paifor x in range(0, 3):
$$$$$c_shit_mutex = Mutex.new
class RunStuffAsyncPoolBigData
def run
Thread.new do
$$$$$c_shit_mutex.synchronize { c_shit }
run_only_thread_safe_shit_in_here_yo
end
end
@evie404
evie404 / wtf.rb
Created February 22, 2016 23:23
wtf ruby
class Lol
def initialize(some_array)
@some_array = some_array
end
def lol
puts some_array.inspect # returns value
some_array += [1] # undefined method `+' for nil:NilClass (NoMethodError)
end
@evie404
evie404 / love_testing
Last active August 29, 2015 14:25
How I Learned to Love Testing
Better Testing in Ruby (or "How I Learned to Love Testing")
==============================
Introduction:
- Ricky
- Software Engineering @ Airbnb (Previous: Twitter, Aniarc)
Beginning:
- "I wrote the code, I already know it works!"
@evie404
evie404 / gist:cbbc5f23b1f7a3a99043
Created January 23, 2015 11:00
十萬個為什麼
十萬 = 100_000
class Fixnum
def 個
times.map { yield }
end
end
puts 十萬.個 { "為什麼" }
//1. Create a variable called test of type boolean and assign the variable the value true.
boolean test = true;
//2.Create a variable called a of type int and assign the variable the value 5.
int a = 5;
/*3.Type in an if statement that adds 1 to a if test has value true and subtracts 1 from a if test has value false.
Helpful hint: The DrJava interactions pane will evaluate an expression after you hit the return key if what you have typed in is a valid expression. To keep the interactions pane from evaluating your if statement prematurely, either type the entire statement in one line or place the statement inside braces { }*/
if (test == true) {
a + 1;
}
else {