Skip to content

Instantly share code, notes, and snippets.

View DanielZwijnenburg's full-sized avatar

Daniël Zwijnenburg DanielZwijnenburg

View GitHub Profile
@ventsislaf
ventsislaf / phoenix_heroku_reset_db.md
Last active May 18, 2023 14:14
Reset database on Heroku running Phoenix app

Note: Don't do this on a production evniroment!

Get the heroku database name:

heroku pg:info

Name can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@Odaeus
Odaeus / application_controller.rb
Last active June 15, 2021 09:34
Alternative to Rails' sharing of instance variables between controller and views.
class ApplicationController < ActionController::Base
# Creates an accessor which is exposed to the view
def self.view_accessor(*names)
attr_accessor *names
helper_method *names
end
end
@coreyhaines
coreyhaines / A Description of Rules
Created August 15, 2012 03:45
100 x 100 Game of Life Kata
Write a system that evolves a 100 x 100 grid of cells
to the next generation according to the following rules.
1) Any living cell with less than 2 live neighbors dies
2) Any living cell with 2 or 3 live neighbors stays alive
3) Any living cell with more than 3 live neighbors dies
4) Any dead cell with exactly 3 lives neighbors comes to life
Note: A cell has 8 neighbors
...
@coreyhaines
coreyhaines / steps.txt
Created July 20, 2012 15:00
String Calculator Kata Steps
*credit to Roy Osherove http://osherove.com/tdd-kata-1/ *
1, Create a simple String calculator with a function #add
- The method can take 0, 1 or 2 numbers and will return their sum (for an empty string, it will return 0) for example "" or "1" or "1,2"
- Start with the simplest test case of an empty string and move to 1 and 2 numbers
- Remember to solve things as simple as possible so that you force yourself to write tests you did not think about
- Remember to refactor after EACH passing test
@collinschaafsma
collinschaafsma / Resources for talk
Created February 28, 2012 18:24
Talk resources for: Stop putting every class in the models directory.
Example Rails app
https://github.com/collinschaafsma/loyd
Example Sinatra app
https://github.com/collinschaafsma/slimfit
Awesome talk by Uncle Bob.
http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years
Clean Code Book
@jzazove
jzazove / gist:1479763
Created December 15, 2011 03:54
URL Friendly Javascript Regex
/* function to urlify a string */
var urlify = function(a){return a.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '')};
/* usage example */
var str_a = "* The Best Wallpaper Magazine in the . ? & world! : Rjer9238131 & ";
urlify(str_a)
/* returns */
"the-best-wallpaper-magazine-in-the-world-rjer9238131"
@jacobat
jacobat / gist:1240695
Created September 25, 2011 15:06
Comments for Cory Haines fast tests talk

Introduction

Corey Haines gave his Fast Tests talk at the Golden Gate Ruby Conference 2011 (http://confreaks.net/videos/641-gogaruco2011-fast-rails-tests), here's my feedback on it.

So first up, I think it's very interesting to see another take on how to speed up Rails testing. There's been a focus on it for a couple of years now with various solutions coming for it. From running tests in parallel, to tweaking the filesystem for faster access. Corey Haines take on it is that we should isolate ourselves from the framework that Rails provides and do as much as possible in plain Ruby objects and modules. In his talk he shows how he has been able to massively improve the runtime of his tests by implementing this.

I think it is a logical next step to the current that has been in the community for a while where we have been debating how to improve the design of Rails applications.

Objections

@9z0b3t1c
9z0b3t1c / env.rb
Created June 16, 2009 15:22
Webrat Cucumber Mechanize steps to test google
require 'webrat'
require 'webrat/mechanize'
include Webrat::Methods
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :mechanize
end