Skip to content

Instantly share code, notes, and snippets.

View jrhames's full-sized avatar

Francisco Hames jrhames

View GitHub Profile
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@edufelipe
edufelipe / is_wireless.c
Created July 29, 2013 21:33
C example code to list all network interfaces and check whether they are wireless or not. Linux only. Tested on Ubuntu 10.04 and 12.04, but should be compatible with pretty much everything out there.
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <ifaddrs.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/wireless.h>
@jrhames
jrhames / moment-holidays.js
Last active January 19, 2023 03:12
Holidays plugin for Moment.JS
//## Moment.JS Holiday Plugin
//
//Usage:
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
//
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"
//
//Holidays:
require 'nokogiri'
require 'open-uri'
require 'webmock'
require 'vcr'
VCR.config do |c|
c.cassette_library_dir = 'vcr_cassettes'
c.stub_with :webmock
end
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@wilkerlucio
wilkerlucio / gist:1389578
Created November 23, 2011 19:07
Ruby & Rails Learning Books
└── Programming Ruby 1.9 (http://pragprog.com/book/ruby3/programming-ruby-1-9)
├── Agile Web Development with Rails (http://pragprog.com/book/rails4/agile-web-development-with-rails)
│   └── Crafting Rails Applications (http://pragprog.com/book/jvrails/crafting-rails-applications)
├── Metaprogramming Ruby (http://pragprog.com/book/ppmetr/metaprogramming-ruby)
└── The RSpec Book (http://pragprog.com/book/achbd/the-rspec-book)
@macdonst
macdonst / speech.html
Created May 9, 2011 16:02
PhoneGap Android TTS Plugin Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PhoneGap Events Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.5.js"></script>
<script type="text/javascript" charset="utf-8" src="tts.js"></script>
<script type="text/javascript" charset="utf-8">