Skip to content

Instantly share code, notes, and snippets.

View tonycoco's full-sized avatar

Tony Coconate tonycoco

View GitHub Profile
@tonycoco
tonycoco / 0-readme.md
Created December 3, 2012 17:05 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

require 'sauce'
require 'capybara'
require 'capybara/rails'
require 'capybara/sauce'
class ActionDispatch::IntegrationTest
include Rails.application.routes.url_helpers # for x_path and x_url helpers
include Capybara::DSL
def require_js
@tonycoco
tonycoco / Procfile.local
Created May 31, 2013 20:28
Example local - Procfile.local
log: tail -f log/development.log
redis: redis-server /usr/local/etc/redis.conf
db: postgres -D /usr/local/var/postgres
@tonycoco
tonycoco / active_admin.js
Last active July 15, 2017 18:34
Array of Hashes input for ActiveAdmin and Formtastic
$('.array-of-hashes-tables').on('click', '.array-of-hashes-table .remove', function(event) {
event.preventDefault();
$(this).closest('.array-of-hashes-table').remove();
});
$('.array_of_hashes .add').on('click', function(event) {
event.preventDefault();
var $this = $(this);
var $tables = $this.siblings('.array-of-hashes-tables');
var $cloneable = $tables.find('.cloneable').first();
@tonycoco
tonycoco / tm2-bundles
Created September 14, 2012 17:01
TextMate 2 Bundles
These are some needed bundles for TM2...
cd ~/Library/Application Support/Avian/Bundles
git clone https://github.com/cucumber/cucumber-tmbundle Cucumber.tmbundle
git clone https://github.com/kuroir/SCSS.tmbundle
git clone https://github.com/mads379/Whitespace.tmbundle
open Cucumber.tmbundle/color_themes/Sunburst.tmTheme
@tonycoco
tonycoco / jmeterxmltocsv.rb
Created November 3, 2010 19:58
A quick script to convert JMeter log XML files to CSV files for Excel imports (Since, Excel can't import XML data... wow.)
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
XML_FILE = ARGV[0]
CSV_FILE = ARGV[1]
if XML_FILE.nil? || CSV_FILE.nil?
puts 'usage: ruby jmeterxmltocsv.rb source_file target_file'
@tonycoco
tonycoco / image_filters.rb
Created June 11, 2012 15:04
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@tonycoco
tonycoco / bookmarket.js
Last active April 22, 2021 16:58
Safari Bookmarklet for <video> AirPlay options – Copy the `bookmarket.js` snippet and paste it as the address of a bookmark in Safari. Then, while playing any <video> you can click the bookmarklet and the <video> will bring up your AirPlay options.
javascript:if(window.WebKitPlaybackTargetAvailabilityEvent){var videos=document.getElementsByTagName("video");if(videos.length>0)for(var airplayable=videos[0],i=0;i<videos.length;i++)if(!(airplayable=videos[i]).paused){airplayable.webkitShowPlaybackTargetPicker();break}}
@tonycoco
tonycoco / bookmarket.js
Last active April 22, 2021 16:59
Safari Bookmarklet for <video> Picture-In-Picture options – Copy the `bookmarket.js` snippet and paste it as the address of a bookmark in Safari. Then, while playing any <video> you can click the bookmarklet and the <video> will toggle between Picture-In-Picture and Inline.
javascript:var videos=document.getElementsByTagName("video");if(videos.length>0)for(var pipable=videos[0],i=0;i<videos.length;i++)if(!(pipable=videos[i]).paused&&pipable.webkitSupportsPresentationMode&&"function"==typeof pipable.webkitSetPresentationMode){pipable.webkitSetPresentationMode("picture-in-picture"===pipable.webkitPresentationMode?"inline":"picture-in-picture");break}
@tonycoco
tonycoco / auth.py
Last active March 8, 2022 16:27
Google Display & Video 360 Simple Auth
import google.auth
import googleapiclient.discovery
API_NAME = "displayvideo"
API_SCOPES = ["https://www.googleapis.com/auth/display-video"]
API_VERSION = "v1"
credentials, project = google.auth.default(scopes=API_SCOPES)
print(f"Google Cloud Project ID: {project}.")