Skip to content

Instantly share code, notes, and snippets.

@marionzualo
marionzualo / arel_use.rb
Created October 15, 2017 19:22 — forked from abelards/arel_use.rb
Ruby, Rails, ActiveRecord and Arel
# Welcome to my "arel gist"!
## It started hacky, then as an example, but we want it cleaner.
# ActiveRecord
## This is an ORM: you call Ruby methods and get Ruby objects, it makes SQL and object instantiations for you.
## It's Rails' default, but there are alternatives: https://github.com/Sdogruyol/awesome-ruby#orm
Student.all
Topic.first
Workshop.sum(:hours)
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id
@marionzualo
marionzualo / http-benchmark.md
Created June 15, 2016 06:19 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools

Tools

Located in alphabetical order (not prefer)

  • ab – slow and single threaded
  • apib – most of the features of Apache Bench (ab), but is also intended as a more modern replacement
  • boom – HTTP(S) load generator, ApacheBench (ab) replacement, written in Go
  • curl-loader – performance loading of various application services and traffic generation
  • gatling – High performance load testing framework based on Scala, Akka and Netty
  • goad – Goad is an AWS Lambda powered, highly distributed, load testing tool
@marionzualo
marionzualo / jmeter.rb
Created June 15, 2016 06:14 — forked from stevegrossi/jmeter.rb
Sample JMeter test plan using the ruby-jmeter gem
#!/usr/bin/env ruby
require 'ruby-jmeter'
test do
defaults domain: 'beta.stevegrossi.com'
cookies clear_each_iteration: true
@marionzualo
marionzualo / gist:b131ef04c6ad7eaeccb6
Created February 23, 2016 15:20 — forked from andyjbas/gist:9962218
Disable CSS Animations in Poltergeist & Phantomjs. Phantomjs does not like to wait for animations, and you can run in to nasty test flickers because of it. This pattern will disable animations in test env, and not touch any app code.
# env.rb or spec_helper.rb

Capybara.register_driver :poltergeist do |app|
  opts = {
    extensions: ["#{Rails.root}/features/support/phantomjs/disable_animations.js"] # or wherever
  }

  Capybara::Poltergeist::Driver.new(app, opts)
end
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<h3>SVG bar</h3>
<svg>