Skip to content

Instantly share code, notes, and snippets.

/*
Everything with no dependencies comes first. That way, when a new item is added with a dependency on an existing item, it doesn't cause the existing item to jump.
Of course an existing item taking a dependency on an existing item will cause a jump, may as well move the changing item.
An existing item taking a dependency on a new item will also jump. It doesn't really make sense to putting the new item first, out of order, if it doesn't have dependencies.
Basically: order by depth_of_deepest_dependency, original_order
*/
with
creating_objects as (

Code Review

A consolidation of advice and stuff from the internet

What is code review?

Code review one person reading over another's code and offering comments, suggestions, and feedback about how it could be improved. Often this is done at companies or in open source projects as a required step before proposed changes can be merged into a

@ntamvl
ntamvl / controller-concerns-in-rails-4.md
Last active May 12, 2022 14:34
Controller Concerns in Rails 4

Controller Concerns in Rails 4

If you setup a Rails 4 app, you’ll notice the app/models/concerns and app/controllers/concerns directories. Concerns are modules that can be mixed into your models and controllers to share code between them.

Some developers falsely classify mixins as composition when they are actually a form of inheritance. When you include a module in a class, that module’s methods are added to the inheritance chain just like a parent class’ methods are added to a subclass. So, don’t think you’ve solved the problem of inheritance by simply splitting your inherited code into separate files!

That being said, mixins can be a valuable tool to share code between classes that are otherwise unrelated. Here’s an example of how I chose to use it recently.

I am adding admin reporting features to an app I’m hoping to launch soon. I have an admin controller with a simple before filter to redirect if the current user is not an administrator.

class AdminController < ApplicationController
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active November 21, 2025 07:55
Vanilla JavaScript Quick Reference / Cheatsheet
@hlissner
hlissner / codesign_gdb.md
Last active September 29, 2024 00:25
Codesign gdb on OSX
@tache
tache / README-SSL-Certificates.md
Last active June 15, 2017 16:38
LetsEncrypt and AWS

#Using LetsEncrypt SSL certificates on AWS

This is a document for managing the LetsEncrypt certificates on AWS for Cloudfront and Opsworks.

##Setup

The following are instructions for using LetsEncrypt under Mac OS. It is for a single token for a single server.

It is an active project, so make sure you do a pull every so often.

@loisaidasam
loisaidasam / README.md
Last active August 3, 2025 13:13
Sort git tags by semver

If you're like me and you use semver for versioning your tags, you probably hate when you do this:

$ git tag -l
0.1.0
0.10.0
0.2.0
0.3.0
0.3.1
0.4.0

0.5.0

@sharplet
sharplet / lazy_reduce.rb
Created August 7, 2015 10:44
Lazy `#reduce` and `#join` in Ruby
require "rspec/autorun"
class Enumerator::Lazy
def reduce(*)
Lazy.new([nil]) do |yielder, _|
yielder << super
end
end
def join(separator="")
@maxivak
maxivak / readme.md
Last active October 18, 2025 00:23
Integrating Gem/Engine and Main Rails App
@nberger
nberger / recipes.clj
Created July 8, 2015 03:22
recipes with core.logic
(ns recipes.core
(:refer-clojure :exclude [==])
(:use [clojure.core.logic]
[clojure.core.logic.pldb :as pldb]))
(db-rel in-larder i)
(db-rel recipe r)
(db-rel in-recipe r i)
(db-rel compound-ingredient i is)