Skip to content

Instantly share code, notes, and snippets.

In celebration of Whyday: Rubyists always want to show others the beautiful code
they have created, hence the question: Has Anybody Seen My Code?
Has Anybody Seen My Code
(sung to the tune of Has Anybody Seen My Gal)
Clean and small, works for all,
Ruby is my all in all.
Has anybody seen my code?
@ryanbriones
ryanbriones / gist:808938
Created February 3, 2011 02:39
some jQuery to cycle through web fonts
function setGlobalFont(fontName) {
console.log('setting font to ' + fontName);
document.body.style.fontFamily = fontName + " !important";
}
$(document).ready(function() {
$.fonts = [
"Arial", "Verdana", "Geneva", "Helvetica", "Helvetica Neue",
"Georgia", "Palatino", "Times New Roman", "Times",
"Courier New", "Courier"
@jimweirich
jimweirich / RubyCodingHigh.txt
Created June 25, 2011 02:55
Ruby Coding High Lyrics and Chords
Ruby Coding High
Weirich / Denver
G C D
It was born in the mountains of a far and distant land,
G C
Bringing hope to a world lost and drear.
G Em C D
Created as a promise to coders far and wide,
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@searls
searls / wtg_google.md
Last active August 21, 2016 20:42
Google Analytics' Reporting API (v3) is returning 403s, help!

Why is Google Analytics giving me 403s?

If you find this via a Google search, it's because you're seeing a 403 error in response to a Google Analytics data.get API call. You've gone through the 18 steps necessary to register a Google app, enable the Analytics API, generate a client ID as a service account, download a p12 certificate, authorize the service account email from the Google Analytics admin page, download a Google Client library in your programming language of choice, and you've finally just written a bit of code which calls the Google API for Google Analytics.

However, something is amiss! Because every request is returning the vague—and seemingly inaccurate—message, "User does not have sufficient permissions for this profile".

"But I just set all that up!", one might exclaim. And truly, there seems to be no explanation for why every call is failing. After all, you entered in your Google Analytics account ID for that API call. It's the account ID you see plastered throughout the Goog

@al2o3cr
al2o3cr / README.md
Created June 25, 2018 10:44
STI method generation optimization

Reducing STI memory usage

if there are many STI child classes, ActiveRecord generates methods for each one individually. This is wasteful in the typical case, since all the children share the same underlying columns.

The small patch included here causes those methods to instead be generated in the parent class, shared amongst all the subclasses.

DO NOT use this if you call methods like attribute :foo to adjust the typecasting of columns in individual models.