Skip to content

Instantly share code, notes, and snippets.

View wendy0402's full-sized avatar

wendy kurniawan soesanto wendy0402

View GitHub Profile
@wendy0402
wendy0402 / break.py
Created April 12, 2017 01:48 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))

Checklist Barang

Group

  • Tenda
  • Kompor
  • Peralatan masak (panci)

Pribadi

  • Ransel/tas gunung
@wendy0402
wendy0402 / OpenSSL fix.md
Created October 12, 2016 00:39 — forked from mislav/OpenSSL fix.md
Fix OpenSSL certificate errors on Ruby 2.0

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

@wendy0402
wendy0402 / docker step
Created September 27, 2016 02:38
setup headless chrome for CI with karma
- ./bin/install_chrome.sh
- npm install
- xvfb-run -a ./node_modules/karma/bin/karma start --single-run
@wendy0402
wendy0402 / gist:cc942aed8f183a820d5712bebb020976
Created May 6, 2016 03:59
delete branches that has been merged
git branch --merged | grep -v "\*" | grep -v "YOUR_BRANCH_TO_KEEP" | xargs -n 1 git branch -d
# config/environments/development.rb
Hello::Application.configure do
# ...
# https://rails.lighthouseapp.com/projects/8994/tickets/4676-reload-routes-on-each-request-in-dev-mode
service_reloader = ActiveSupport::FileUpdateChecker.new(Dir["app/services/**"]) { Rails.application.reload_routes! }
config.to_prepare do
service_reloader.execute_if_updated
@wendy0402
wendy0402 / show_page with css capybara
Created February 3, 2016 05:53
show_page with css dont forget to run rails server first
def show_page
puts "Showing page #{current_path}"
save_page Rails.root.join( 'public', 'capybara.html' )
%x(launchy http://localhost:3000/capybara.html)
end
def submit_form(selector = 'form')
within(selector) do
if page.has_css?('input[type=submit]')
#puts "Click submit"
find('input[type=submit]').click
elsif page.has_css?('button')
#puts "Click button"
find('button').click
else
#puts "Call submit()"
@wendy0402
wendy0402 / test redirection using Rack::Test
Last active January 26, 2016 11:23
test redirection using Rack::Test, rspec with poltergeist
before do
# because we cannot mock redirection, set driver to not follow redirects
@current_driver_config = page.driver.instance_variable_get(:@options)
page.driver.instance_variable_set(:@options, @current_driver_config.merge({follow_redirects: false}))
end
after do
# set driver setting to follow redirection again
page.driver.instance_variable_set(:@options, @current_driver_config)
end
@wendy0402
wendy0402 / gulpfile.js
Created September 29, 2015 16:04
gulpfile to watch, browserify and copy to public
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
gulp.task('browserify', function(){
browserify({debug:true, entries: 'src/js/main.js'})
.transform(babelify)