Skip to content

Instantly share code, notes, and snippets.

Pedro Carriço pedrocarrico

Block or report user

Report or block pedrocarrico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lambda2img.Dockerfile
FROM mikesir87/aws-cli as code
RUN wget -O `aws lambda get-function --function-name $FUNCTION_NAME --query 'Code.Location' --output text`
mechcozmo / IAM Permissions
Last active Jan 14, 2020
A list of IAM permissions you can use in policy documents. Collected from the myriad of places Amazon hides them. (incomplete)
View IAM Permissions
marionzualo / benchmark_with_default_arguments.rb
Last active Nov 7, 2015
Benchmark keyword arguments, normal arguments and an options hash in Ruby 2.1.5 and 2.2.3. Background: Koichi's talk on the evolution of keyword parameters at Ruby Conf PT - Inspired by
View benchmark_with_default_arguments.rb
require 'benchmark/ips'
def keyword(a:1,b:2,c:3)
a + b + c
def normal(a=1,b=2,c=3)
a + b + c
samselikoff /
Last active Dec 11, 2019
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.

Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
View node-command-line-options.txt
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
andyjbas / gist:9962218
Last active Jul 19, 2018
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.
View gist:9962218
# env.rb or spec_helper.rb

Capybara.register_driver :poltergeist do |app|
  opts = {
    extensions: ["#{Rails.root}/features/support/phantomjs/disable_animations.js"] # or wherever
  }, opts)
trianglegrrl / ember-cucumber.rb
Last active Feb 23, 2017
Testing Ember with Cucumber
View ember-cucumber.rb
# You need some sort of indication that an Ajax transaction exists. doesn't seem to do the
# trick, so we use the following JS (well, we use CoffeeScript, but whatever) that gets inserted into
# our application.
#$(function() {
# var body, doc;
# body = $('body');
# doc = $(document);
# doc.ajaxStart(function() {
# return body.addClass('ajax-in-progress').removeClass('ajax-quiet');
blacktm /
Last active Dec 30, 2019
A Bash script to install Ruby 2.6 on the Raspberry Pi (Raspbian)
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.6 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
# Run from the web:
# bash <(curl -s
# --------------------------------------------------------------------------------------------
# Welcome message
kyletcarlson / rspec_model_testing_template.rb
Last active Jan 19, 2020
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
reidransom / gist:6042016
Created Jul 19, 2013
Auto-starting VirtualBox VMs on OS X
View gist:6042016

Auto-starting VirtualBox VMs on OS X

After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

Link to original article.

Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

sudo cp \
    /Applications/ \
You can’t perform that action at this time.