Skip to content

Instantly share code, notes, and snippets.

View theharq's full-sized avatar

Hildebrando Rueda theharq

  • Berlin, Germany
View GitHub Profile
@theharq
theharq / gist:25cd583da57fe8a7c07f
Created February 10, 2016 22:13
libv8 and the rubyracer failed installation - El Capitan
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.7' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
OSX 10.11.3
@theharq
theharq / output.txt
Created February 9, 2016 21:41 — forked from ddlsmurf/output.txt
YAML succinct tutorial
# Example with basic types
---
hash:
  string: some text
  number: 12345
  array_of_bool: [on, off, true, false, yes, no]
  ruby symbol: :symbol
  array:
    - item one
    - item two
@theharq
theharq / gist:0b7032e585cea8a45507
Created December 23, 2015 18:21
To generate a new data.yml file
rake db:drop db:create db:schema:load db:data:load
// run rake db:migrate or custom rake task to modify data
rake nested-questions:seed:reviewer-report-task
rake db:data:dump
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
fileSelectionChanged(previews) {
this.set('previews', previews);
}
}
@theharq
theharq / pull_request.md
Last active October 23, 2015 15:09 — forked from diiq/pull_request.md
Pull Request Template

JIRA issue: link-to-jira

What this PR does:

Explain in a few sentences what functionality changed, and how. Can your changes be seen by a user? Then add a screenshot. Is it an interaction? Perhaps a recording.

Notes

Are there any surprises? Anything that was particularly difficult, or clever, or made you nervous, and should get particular attention during review? Call it out.

@theharq
theharq / gist:c8451cdfe2423aedfda9
Created April 21, 2015 00:49
Token based authentication on rails, Example
class DummyController < ApplicationController
before_action :authenticate
# things...
protected
def authenticate
authenticate_or_request_with_http_token do |token, options|
Dummy.find_by(auth_token: token)
@theharq
theharq / query_trace.rb
Last active March 14, 2016 18:22
Get the stack trace ( caller ) of a sql query, handy to know where a sql query was made
ActiveSupport::Notifications.subscribe("sql.active_record") do |_, _, _, _, details|
if details[:sql] =~ /INSERT INTO...."/
puts caller.join("\n")
puts "*" * 50
end
end
@theharq
theharq / bullet.rb
Created December 19, 2014 23:39
Run bullet gem in a block
unless Rails.env.production?
if defined?(Bullet)
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.alert = true
end
def with_bullet
require 'bullet'
Bullet.enable = true
$flash-foreground: $background-color;
.flash{
background: $background-color;
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
font-size: 16px;
font-weight: bold;
left: 0;
padding: $base-spacing 0;
position: fixed;
# how to know the number of cores
sysctl -n hw.ncpu
# set bundler config with 4 cores
bundle config --global jobs 4