Skip to content

Instantly share code, notes, and snippets.

View mostlyerror's full-sized avatar

Ben Poon mostlyerror

View GitHub Profile
require 'httparty'
class KuCoin
def self.get_symbols_list(opts = {})
url = "https://api.kucoin.com/api/v1/symbols"
HTTParty.send(:get, url, opts).yield_self do |response|
response
end
end
@mostlyerror
mostlyerror / skus_dupes.rb
Created October 29, 2021 03:18
deduplicate columns in csv using a Set
require 'set'
require 'csv'
require 'amazing_print'
filename = "skus.csv"
s1 = Set.new
old_skus = []
old_skus_dupes = []
@mostlyerror
mostlyerror / animal.rb
Created August 20, 2021 15:08
attr_reader, attr_writer, attr_accessor in plain Ruby without Rails
# Attribute readers, writers, and accessors for POROs (Plain Old Ruby Objects)
# no ActiveRecord
# no Rails
class Animal; end
Animal.new.speak # NoMethodError (undefined method `speak' for #<Animal:0x00007fb19c940840>)
@mostlyerror
mostlyerror / resume.json
Last active August 1, 2021 02:38
Resume
{
"basics": {
"name": "Benjamin Poon",
"label": "Software Developer",
"picture": "https://avatars.githubusercontent.com/u/2030072?v=4",
"email": "benjamintpoon@gmail.com",
"phone": "(832) 275-1259",
"website": "",
"summary": "Software Developer with experience spanning the full stack: front end, back end, test, dev ops/infrastructure. I am always excited to explore different technologies in order to deliver applications that solve business problems.\n\nI love to steer a project through its full life cycle, transforming an initial idea into reality. While I rely on good documentation and best practices, I also value \"thinking outside of the box\"​ - I enjoy exploring clever and unorthodox ways to achieve our business goals.\n\nSome technologies I love: Ruby on Rails, Elixir, PostgreSQL, Linux, Docker, Javascript, Redis, AWS, ReactJS, and many more.\n\nWhen I’m not getting paid to code, I'm outdoors. I love playing soccer, fishing, and hiking with my wife and three dogs.",
"lo
function weightShamer (gender, weight) {
var idealWeight = (gender == "male" ? 165 : 140);
if (weight == idealWeight) {
message = "good";
} else if (weight < idealWeight) {
message = "under weight";
} else {
message = "over weight";
}
@mostlyerror
mostlyerror / log_out.txt
Created January 6, 2017 23:16
Excerpt from kernel system message buffer on production
# see the current log output on production with:
# dmesg | grep bundle
[1280275.496381] Memory cgroup out of memory: Kill process 20821 (bundle) score 178 or sacrifice child
[1280275.496416] Killed process 20821 (bundle) total-vm:1184088kB, anon-rss:547236kB, file-rss:11564kB, shmem-rss:0kB
[1280275.673954] oom_reaper: reaped process 20821 (bundle), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
[1283252.998599] [30469] 0 30469 145952 52490 192 4 0 0 bundle
[1283252.998611] [30758] 0 30758 297303 110655 334 5 0 0 bundle
[1283252.998621] [30768] 0 30768 314715 122308 347 5 0 0 bundle
@mostlyerror
mostlyerror / assessment1.js
Created November 4, 2014 22:54
assessment1.js
var fruits = ['apple', 'banana', 'tomato?', 'strawberry', 'peach'];
Given the above fruits array, return...
1. The first fruit element
2. The last fruit, without mutating the fruits array
3. The last fruit, removing it from the fruits array.
@mostlyerror
mostlyerror / gist:6f15f04fd77a72d512c3
Created October 15, 2014 01:52
rock paper scissors
var choices = ['rock', 'paper', 'scissors'];
var userChoice = prompt("Do you choose rock, paper, or scissors?");
var randNum = Math.floor(Math.random() * choices.length));
var computerChoice = choices[randNum];
var nameString = function(name) {
return "Hi, I am" + " " + name;
};
nameString("david"); <~~~ Call nameString() by passing it your name, and use console.log to print the output.
nameString(console.log("david")); <~~ Show result as "Hi, I am undefined"
Not quite sure as how to do that. As I tried this and I know that this is incorrect.
nameString("david")
^
$(function(){
var oldGuardians = [
{
name: "Star Lord",
notes: "Team leader"
},
{
name: "Drax the Destroyer"
},