Skip to content

Instantly share code, notes, and snippets.

@dbernheisel
dbernheisel / finder_functions.ex
Last active January 12, 2021 13:05
Elixir module to use for Ecto models. This macro will implement Rails-like finder functions for the given module.
defmodule Common.FinderFunctions do
@moduledoc """
Certainly not a perfect replication of Rails' finder methods, but at least gives Rails developers
some sense of home with Ecto. This does not reach into associations, nor is it huge-db friendly.
## Usage:
0. Don't. Just learn Ecto.
1. In your given module that implements Ecto's schema, let it
`use Common.FinderFunctions, repo: MyApp.Repo`. This also assumes there
is a changeset function on your model.
@skv-headless
skv-headless / reactive.md
Last active September 22, 2016 12:01
Lighting talk proposal to amazing https://reactiveconf.com

The most pragmatic way to write a mobile app

I want to talk about different approaches in writing mobile apps. I will tell you when it is a good idea to pretend that your responsive website is an app. Also about evolution of this idea from basecamp and DHH - turbolinks. I will tell you about my lovely ReactNative and the problems it has. When you can't avoid writing apps in native sdk and what difficulties you may face going this way.

Last year I used to write apps in objective-c. My open source works mostly around react native but my heart is with Ruby on Rails.

docker_compose_exec() {
docker exec -it $(docker-compose ps | grep $1 | awk '{print $1}') ${@:2}
}
alias dcrun='docker_compose_exec web'
alias dcenter='docker_compose_exec web bash'
alias dcenter_new='docker-compose run web bash' # if container is not up
@vadv
vadv / build.cmd
Last active January 30, 2024 15:12
Build PostgreSQL for windows
REM BUILD DEPENDS
REM 1. .NET 4.0
REM 2. MICROSOFT SDK 7.1
REM 3. ACTIVE PERL <= 5.14
REM 4. PYTHON 2.7
REM 5. MSYS2
REM 6. 7Z
REM SET POSTGRESQL VERSION
SET PGVER=9.4.4
@joekarl
joekarl / gist:86d9bdb8f9af044710b7
Last active May 23, 2016 13:41
go-libapns example app
package main
import (
apns "github.com/joekarl/go-libapns"
"fmt"
"io/ioutil"
"time"
)
type HandleCloseErrorFn func (closeError *apns.ConnectionClose)
@JunichiIto
JunichiIto / alias_matchers.md
Last active June 24, 2024 21:02
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@basti
basti / application.rb
Last active March 1, 2021 10:42 — forked from keighl/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false
@tyabe
tyabe / stacked_middlewares.rake
Last active March 9, 2021 10:28
Display lists of all stacked rack middleware for your padrino app
##
# This is rake task of padrino-framework
# Display lists of all stacked rack middleware for your padrino app.
# distributed under the MIT License(http://tyabe.mit-license.org/)
#
def stacked_middlewares(app, args)
require Padrino.root('config/boot.rb')
app_obj = app.app_obj
instance = app_obj.new!
build = app_obj.build(instance)
@ryanb
ryanb / development.rb
Created November 27, 2012 21:38
Some rack middleware to add headers to asset pipeline.
class AssetHeaders
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
response = @app.call(env)
if request.path =~ /^\/assets\//
# there maybe a better way to add headers
@unak
unak / history.txt
Last active November 29, 2021 01:40
The History of Ruby
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi