Skip to content

Instantly share code, notes, and snippets.

Avatar
🐉
Kaizen

Kash Nouroozi knrz

🐉
Kaizen
  • Toronto, Canada
View GitHub Profile
View pinlist-web react directory structure
.
├── assets
│   ├── icons
│   │   ├── favicon-128.png
│   │   ├── favicon-16.png
│   │   ├── favicon-32.png
│   │   └── favicon-48.png
│   └── illustrations
│   └── HouseParty.svg
├── package.json
View quickTabSolarized.css
body, .qs_input, .noresult {
background: #FDF6E3;
font-family: "Operator Mono";
}
body {
width: 640px;
padding: 4px;
}
View repo.ex
defmodule Repo do
use Task
require Logger
@moduledoc """
It's hard to find the docs for the MongoDB adapter. Here's a direct link:
https://hexdocs.pm/mongodb/Mongo.html
"""
def start_link(_) do
@knrz
knrz / rails-session
Last active May 22, 2018
An AppleScript to get a Rails server, console, and general session open in iTerm.
View rails-session
#!/usr/bin/env osascript -l JavaScript
function open(name) {
var application = Application(name);
application.running() || application.open();
return application;
}
function bootstrapTerminal(project) {
var terminal = open("iTerm");
View cryptodata.py
import os
import csv
import json
import re
from datetime import datetime
from urllib.request import urlopen
from urllib.parse import urlencode
os.chdir(os.path.dirname(__file__))
View graph.py
G1 = { 1: [2, 5],
2: [1, 3],
5: [4] }
G2 = { 1: [2, 4],
2: [3, 4],
3: [5],
5: [2, 6] }
G3 = { 1: [2, 5],
2: [3],
5: [4] }
View graph.py
G1 = { 1: [2, 5],
2: [1, 3],
5: [4] }
G2 = { 1: [2, 4],
2: [3, 4],
3: [5],
5: [2, 6] }
G3 = { 1: [2, 5],
2: [3],
5: [4] }
View keybase.md

Keybase proof

I hereby claim:

  • I am knrz on github.
  • I am knrz (https://keybase.io/knrz) on keybase.
  • I have a public key ASCJ48JeXy8WhOQrwZKIYe_JM6313bXFxV00SQfJmU_1BQo

To claim this, I am signing this object:

View chain.rb
class Chain < Struct.new(:value)
def method_missing(method, *args, &block)
next_value = self.value.public_send(method, *args, &block)
self.value = next_value unless method.to_s[-1] == "!"
self
end
end
# Now you can chain bang methods (or regular methods)!
Chain.new([1, 2, 3, 4, 5]).reject!(&:odd?).reverse!.value # => [4, 2]
View salary.rb
class Salary
attr_reader :total_compensation
def initialize(base:, bonus_percentage: 0, seniority_factor: 0, deduction:)
@total_compensation = base.tap do |n|
n += n * bonus_percentage
n += n * seniority_factor
n -= deduction
end
end
You can’t perform that action at this time.