Skip to content

Instantly share code, notes, and snippets.

@brain64bit
brain64bit / 00_etc-hosts.md
Created July 31, 2021 07:16 — forked from mul14/00_etc-hosts.md
/etc/hosts for Vimeo, Reddit, and Imgur.

Unblock Vimeo, Reddit, Imgur, dan NPM

Saya support Internet Positif untuk memblokir porn, situs judi, dan hal-hal ilegal lainnya. Tapi pemerintah dan ISP sangat konyol karena tidak mengizinkan akses ke Vimeo, Reddit, Imgur, Netflix--yang mana bukanlah situs dengan konten utama ilegal.

Linux / BSD / macOS

Tambahkan list di bawah ke /etc/hosts.

Windows

@brain64bit
brain64bit / capybara-headless-chrome.rb
Created August 15, 2018 13:40 — forked from matthewrudy/capybara-headless-chrome.rb
Running headless chrome on capybara with selenium webdriver
require "selenium/webdriver"
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) }
)
@brain64bit
brain64bit / Capybara.md
Created August 15, 2018 12:28 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@brain64bit
brain64bit / reactRailsTestSetup.md
Created February 26, 2018 17:22 — forked from andrewprogers/reactRailsTestSetup.md
Setting up A new React on Rails app with webpacker and full test suite

React on Rails with Test Suite (Karma, Jasmine, Enzyme, PhantomJS)

The steps included here detail the steps I followed to get a new React on Rails app set up, with a focus on testing JS components with Karma / Jasmine / Enzyme. A lot of this was liberally borrowed / modified from the Launch Academy curriculum, but there are some additional steps involved to get everything working with webpacker:

Unless otherwise specified, run the code in the terminal

Install Rails with Webpacker configured for React:

rails new project-name
cd project-name
@brain64bit
brain64bit / 0. nginx_setup.sh
Last active February 19, 2018 16:11 — forked from mikhailov/0. nginx_setup.sh
Nginx conf setup
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@brain64bit
brain64bit / thread-pool.rb
Created January 30, 2018 16:13 — forked from rosenfeld/thread-pool.rb
Simple thread pool implementation in Ruby
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

require "rspec/core/formatters/base_text_formatter"
require 'headless'
require 'fileutils'
class AcceptanceVideoFormatter < RSpec::Core::Formatters::BaseTextFormatter
def initialize(output)
@headless = Headless.new(
video: {
nomouse: true,
@brain64bit
brain64bit / Selenium Cheat Sheet.md
Last active June 22, 2016 03:26 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby
@brain64bit
brain64bit / README.md
Last active March 12, 2016 15:45 — forked from hofmannsven/README.md
My simply Git Cheatsheet