Skip to content

Instantly share code, notes, and snippets.

View colindensem's full-sized avatar
🏠
Working from home

Fynn.Codes colindensem

🏠
Working from home
View GitHub Profile
@colindensem
colindensem / sample.rb
Last active January 4, 2021 13:34
Ruby Sample
class SomeClass
SOME_CONSTANT = "upper case name".frozen
def initialize(attributes)
@some_attribute = attributes[:some_attribute]
@another_attribute = attributes[:another_attribute]
@user_factory = attributes[:user_factory]
end
def method_with_arguments(argument_one, argument_two)
@colindensem
colindensem / README.md
Created July 27, 2020 07:14 — forked from wvengen/README.md
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

const navToggles = {
sidebar: document.getElementById("sidebar"),
profileDropdown: document.getElementById("profileDropdown"),
sidebarToggle: function() {
if (sidebar.style.display === "none") {
sidebar.style.display = "block";
} else {
sidebar.style.display = "none";
}
@colindensem
colindensem / rspec_model_testing_template.rb
Created September 24, 2018 08:43 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@colindensem
colindensem / fresh-chrome-with-custom-tz.sh
Created February 15, 2018 09:05 — forked from prasadsilva/fresh-chrome-with-custom-tz.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
1) test users list_users/0 returns all users (Compass.AccountsTest)
test/compass/accounts/accounts_test.exs:22
Assertion with == failed
code: assert Accounts.list_users() == [user]
left: [%Compass.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, id: 242, inserted_at: ~N[2018-02-11 13:20:55.161318], password_hash: "$2b$04$7CXiD.uSsVQ.0UzK7.yBfOB6LC85qW8pUHj4pWDa6e5PJLpFRWFFK", updated_at: ~N[2018-02-11 13:20:55.161332], username: "some username", password: nil, password_confirmation: nil}]
right: [%Compass.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, id: 242, inserted_at: ~N[2018-02-11 13:20:55.161318], password_hash: "$2b$04$7CXiD.uSsVQ.0UzK7.yBfOB6LC85qW8pUHj4pWDa6e5PJLpFRWFFK", updated_at: ~N[2018-02-11 13:20:55.161332], username: "some username", password: "some password_hash", password_confirmation: "some password_hash"}]
stacktrace:
test/compass/accounts/accounts_test.exs:24: (test)
@colindensem
colindensem / Output
Created January 30, 2018 22:36
Ember cli lightning configs
ember deploy development --verbose
Registering hook -> configure[build]
Registering hook -> build[build]
Registering hook -> configure[redis]
Registering hook -> fetchInitialRevisions[redis]
Registering hook -> upload[redis]
Registering hook -> willActivate[redis]
Registering hook -> activate[redis]
Registering hook -> fetchRevisions[redis]
Registering hook -> didDeploy[redis]
@colindensem
colindensem / nanocloud.sh
Created July 26, 2017 22:11 — forked from glinton/aProxy.md
Install and use nanobox on a linux cloud box (or about any other linux box). Tested on DigitalOcean 16.04
# become root (if not already)
sudo su
# create user 'nanouser' with password 'password'
useradd -m -p papAq5PwY/QQM -s /bin/bash nanouser
# make 'nanouser' a sudoer
usermod -aG sudo nanouser
# get docker
nanobox run --verbose
Preparing environment :
Building runtime :
Starting docker container :
Preparing environment for build :
- Copying ssh keys into the build environment...
- Setting up directories and permissions...
- Cloning engine :
Cloning into 'engine'...
@colindensem
colindensem / gist:fc9879b8c43282ba032b529af613f21f
Last active March 12, 2017 17:37
rSnapshot per host Config - Adaptations for centmin
#
# For each new host to back up, run these as root:
#
#
# First, specify the hostname (used in the config files).
# This hostname must actually work.
HOST="server.fqdn"
#