Skip to content

Instantly share code, notes, and snippets.

View ameuret's full-sized avatar

Arnaud Meuret ameuret

View GitHub Profile
@ameuret
ameuret / buying_steps.rb
Created February 6, 2014 21:40
How to help Capybara wait for a node to appear as a result of some asynchronous operation
include CapybaraAccessories
# This step occurs after an item was added to the cart through XHR
# It must wait for the call to return and for the UI to update.
# A badge must become visible and contain the number of items in cart.
# Without this kind of wait code Capybara's waiting features (2.2.1)
# still miss the update and fail the test.
Then(/^I see a caddie badge with (\d+) item\(s\)$/) do |count|
wait_for{page.find('#count')}.should have_content(count)
@lfender6445
lfender6445 / gist:9919357
Last active November 7, 2024 08:35
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@fidothe
fidothe / pdfx.rb
Last active October 10, 2023 15:57
Worked example for creating a PDF/X-1a:2003 document with Prawn
require 'prawn'
require 'prawn/measurements'
# I have a small collection of links to the resources I used to figure all
# this out: http://pinboard.in/u:fidothe/t:pdfx
module PDFX
class PageBox
include Prawn::Measurements
attr_reader :bleed_mm
@ecliptik
ecliptik / aisle.txt
Last active January 20, 2022 09:46
Aisle Strings
Resident data ends at 36c4, program starts at 36c4, file ends at 1dd10
Starting analysis pass at address 36c2
End of analysis pass, low address = 36c4, high address = dffc
[Start of code]
Main routine R0001, 0 locals
@sigmike
sigmike / rmagick_arch.bash
Created January 9, 2018 15:52
Install rmagick with imagemagick 6 on arch
sudo pacman -S libmagick6
PKG_CONFIG_PATH=/usr/lib/imagemagick6/pkgconfig gem install rmagick
# or with bundler:
PKG_CONFIG_PATH=/usr/lib/imagemagick6/pkgconfig bundle install
@hexagon5un
hexagon5un / hull_pcb_case.scad
Created February 4, 2018 22:16
Create a PCB Caddy with OpenSCAD's hull() Command
use <hull.scad>
w = 66.35;
l = 79;
pin_locations = [ [-w/2, -l/2, 0], [-w/2, l/2, 0],
[ w/2, -l/2, 0], [ w/2, l/2, 0] ];
thickness = 1;
$fn = 24;
// CNC-v3.2.scad - Open source CNC machine
// Project page: www.HomoFaciens.de
// Date: 2016-10-11
// Author: Norbert Heinz
// Modified by Unrud <[email protected]> (2018-10-08)
// Display Settings
SHOW_DRILLHOLES = false;
SHOW_BALL_BEARINGS = true;
@krisleech
krisleech / renew-gpgkey.md
Last active November 13, 2024 19:10
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

convert -background none -fill black -font font.ttf -pointsize 140 label:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`~!@#$\%^&*()-_+={}[]|\\,.<>?/:;“"‘'"'" font_texture.png
@Ikariusrb
Ikariusrb / gaussian_random.rb
Last active August 7, 2020 04:24
Ruby RNG that returns a normal distribution between two integers
# MIT License
# Copyright (c) 2020 Ross Becker
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#