Skip to content

Instantly share code, notes, and snippets.

View coddeys's full-sized avatar

Dimas coddeys

  • Capelle aan den IJssel
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@dhh
dhh / gist:981520
Created May 19, 2011 19:27
bulk api
# Bulk API design
#
# resources :posts
class PostsController < ActiveController::Base
# GET /posts/1,4,50,90
# post_url([ @post, @post ])
def show_many
@posts = Post.find(params[:ids])
end
@liangzan
liangzan / .Xresources
Created January 19, 2012 23:26
Xresources for configuring urxvt
! urxvt
URxvt*buffered: true
URxvt*cursorBlink: true
URxvt*underlineColor: yellow
URxvt*font: xft:inconsolata:size=10:antialias=true
URxvt*depth: 32
URxvt*borderless: 1
URxvt*scrollBar: false
URxvt*loginShell: true
Urxvt*secondaryScroll: true # Enable Shift-PageUp/Down in screen
@jhjguxin
jhjguxin / creating-nested-resources-in-ruby-on-rails-3-and-updating-scaffolding-links-and-redirection.markdown
Created July 9, 2012 03:32
Creating nested resources in ruby on rails 3 and updating scaffolding links and redirection
@davidcelis
davidcelis / nginx.conf
Last active October 22, 2025 18:39
Nginx configuration to redirect HTTP traffic to HTTPS (Puma)
upstream puma {
server unix:///var/www/app/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80 default deferred;
server_name example.com;
rewrite ^/(.+) https://example.com/$1 permanent;
}
@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@rkjha
rkjha / nginx-config-rails4-with-puma-ssl-version.conf
Last active November 2, 2023 11:57
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@varyonic
varyonic / gist:542c37648de91a02402a
Last active August 29, 2015 14:08
Deprecated but working version of form_buffers removed by https://github.com/activeadmin/activeadmin/pull/3486
module ActiveAdmin
module Views
class ActiveAdminForm
class DeprecatedFormBufferSubstitute
def initialize(form)
@form = form
end
def << (value)
@form.text_node value.html_safe
end
@mwlang
mwlang / error.txt
Created January 21, 2015 12:47
Below is an example of using Savon to test SOAP endpoints of a Rails app that uses Wash out. The Savon approach works, but Savon likes to mangle the XML you feed it by wrapping it in the SOAP Envelope and Body tags. Therefore, I'm trying to duplicate with Faraday what's working with Savon so I can fully control the XML being fed to the SOAP endp…
Failure/Error: response = post_xml(:stock_update, "single_item")
Faraday::ConnectionFailed:
getaddrinfo: nodename nor servname provided, or not known
# /Users/mwlang/.rvm/gems/ruby-2.1.2/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:80:in `perform_request'
# /Users/mwlang/.rvm/gems/ruby-2.1.2/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:in `call'
# /Users/mwlang/.rvm/gems/ruby-2.1.2/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
# /Users/mwlang/.rvm/gems/ruby-2.1.2/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
# /Users/mwlang/.rvm/gems/ruby-2.1.2/gems/faraday-0.9.0/lib/faraday/connection.rb:177:in `post'