Skip to content

Instantly share code, notes, and snippets.

View capripot's full-sized avatar
💭

Ronan capripot

💭
View GitHub Profile
@capripot
capripot / Capybara.md
Created June 25, 2021 16:53 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@capripot
capripot / download_strategy.rb
Created January 22, 2020 22:56
Homebrew Private Download Strategy
# GitHubPrivateRepositoryDownloadStrategy downloads contents from GitHub
# Private Repository. To use it, add
# `:using => GitHubPrivateRepositoryDownloadStrategy` to the URL section of
# your formula. This download strategy uses Homebrew GitHub.api_credentials
# to authenticate the request.
# This strategy is suitable for corporate use just like S3DownloadStrategy,
# because it lets you use a private GitHub repository for internal distribution.
class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy
require "utils/formatter"
@capripot
capripot / static_file_server_puma_dev.md
Last active November 29, 2017 11:58
Create static file server with puma-dev

Create static file server with puma-dev in 1min

Gemfile

source 'https://rubygems.org'
gem 'rack'
gem 'puma'
#!/usr/local/var/rbenv/shims/ruby
require 'bundler'
paths = Bundler.load.specs.map(&:full_gem_path)
system("ctags -R -f .gemtags #{paths.join(' ')}")
{
"auto_complete": false,
"auto_indent": true,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
@capripot
capripot / SassMeister-input.sass
Last active August 22, 2016 21:24 — forked from hilja/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
$red: #ff0000
$primary-colors: ("red": $red, "green": #00ff00, "blue": #0000ff)
// Key and value together
@capripot
capripot / scrap_nytm.rb
Last active January 13, 2016 12:46
Get hiring New York Tech Meetup websites in a .csv
#!/usr/local/var/rbenv/shims/ruby
#
# Use like this
# ./scrap_nytm.rb > file.csv
#
# You need Nokogiri (gem install nokogiri)
#
require 'rubygems'
@capripot
capripot / i18n.rb
Created March 24, 2015 19:32
Show Rails i18n default scope
module I18n
module Backend
class Simple
module Implementation
alias_method :lookup_orig, :lookup
# Give ability to check I18n looked up keys in lazy mode by setting env var I18N_DEBUG to true
#
def lookup(locale, key, scope = [], options = {})
puts "I18N keys: #{I18n.normalize_keys(locale, key, scope, options[:separator])}" if ENV['I18N_DEBUG']
@capripot
capripot / time_format.rb
Last active August 29, 2015 14:17
Date and Time convenient formatting shortcuts on DateTime, Time and Date objects in Ruby
class Time
def pretty(format = nil)
return unless self
if format == :d
self.strftime("%b. %-d, %Y")
elsif format == :t
self.strftime("%l:M%P")
elsif format == :db
self.strftime("%Y-%m-%d %H:%M:%S")
else