Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
@steveklabnik
steveklabnik / foo_test.rb
Created April 27, 2013 23:25
shared examples in MiniTest As usual, "Just Use Ruby"
require 'test_helper'
describe "foo" do
include SupportsCount
end
@snusnu
snusnu / app.rb
Last active December 17, 2015 15:19
Example dummy app that uses substation, aequitas, ducktrap, anima and mustache. On rack.
require 'pp'
require 'adamantium'
require 'equalizer'
require 'concord'
require 'abstract_type'
require 'aequitas'
require 'ducktrap'
require 'anima'
require 'substation'
mymodule {
@at-root {
.#{&}-header { ... }
.#{&}-footer { ... }
.#{&}-body {
a { ... }
span { ... }
p { ... }
}
}
@evanphx
evanphx / bundle-update-lockfile.rb
Last active August 8, 2016 11:44
Need to update a Gemfile.lock but don't want to install the gems? No problem! Run this in the same directory as your Gemfile!
#!/usr/bin/env ruby
require 'bundler'
gems = ARGV
if gems.empty?
puts "Updating all gems"
Bundler.definition(true)

Want to push to two Git Repos via a single command?

Want to do it easily via a simple .git edit?

My use case is pushing code that resides on Github as well as on Bitbucket. I want it available in both remote locations in case one is unavailable.

Here's how you do it:

Add the two remotes as normal

@dkubb
dkubb / axiom-memory-adapter-examples.rb
Last active December 19, 2015 22:59
Examples for axiom-memory-adapter
require 'axiom-memory-adapter'
adapter = Axiom::Adapter::Memory.new(
customers: Axiom::Relation.new([[:id, Integer], [:name, String]]),
orders: Axiom::Relation.new([[:id, Integer], [:customer_id, Integer]])
)
# Insert customer data
customers = adapter[:customers]
customers.insert([[1, 'Dan Kubb']])
(defun assign-group-from-hash (hash keys)
"creates a series of instance variable assignments in the style @key = hash.fetch(:key)"
(interactive "sHash Name: \nsKeys(separated by a space): ")
(let ((hash-keys (split-string keys)))
(mapc (lambda (key) (insert (format "@%s = %s.fetch(:%s)\n" key hash key))) hash-keys)
)
)
@jbenet
jbenet / simple-git-branching-model.md
Last active February 26, 2026 00:08
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

Too long for a tweet...so, I tweeted this:

"One trend I'm observing is a lot of rubyists being fed up with messy ruby ecosystem are getting excited or even switch to clojure."

People asked me to comment further, so here it goes. First of all I said I'm seeing a trend, which is a fact. I know people who are learning Clojure (and other languages like some people pointed out) hoping to switch from Ruby or they even already left Ruby. Those people got tired of something I called "a messy ecosystem". Maybe not the best selection of words, I dunno. I meant that some people, myself included, find ruby ecosystem - which consists of multiple VMs, practically one web framework and a gazillion of libraries from which huge amount are only semi-working - to be a mess where it's hard to pick up a solid stack to solve bigger problems.

I really don't have time (which is a shame) to come up with some specific details. I could maybe only quickly describe what we're dealing with now at gitorious.org which is being upgraded t

@ngauthier
ngauthier / reportable.rb
Last active December 28, 2015 22:09
Reportable Concern
module Reportable
extend ActiveSupport::Concern
module ClassMethods
# Chain on a scope and specify the fields to extract.
# Example:
# User.enabled.report %{
# :email_opt_in,
# 'created_at as sign_up_date'
# }