Skip to content

Instantly share code, notes, and snippets.

View bear454's full-sized avatar

James Mason bear454

View GitHub Profile
Depends on the "xml-simple" and "net-http-digest_auth" gems...
For Rails 2:
config/environment.rb:
Rails::Initializer.run do |config|
...
config.gem "xml-simple", :lib => "xmlsimple"
config.gem "net-http-digest_auth", :lib => "net/http/digest_auth"
@bear454
bear454 / motorola_cliq2.mpi
Created July 29, 2011 21:19
media-player-info for Motorola CLIQ2 (MB611)
[Device]
Vendor=Motorola
Product=CLIQ2/MB611
AccessProtocol=storage
DeviceMatch=usb:22b8:41d9;
[Media]
OutputFormats=OutputFormats=audio/mpeg;audio/x-ms-wma;audio/3gpp;audio/mp4;audio/aac;audio/vnd.rn-realaudio;audio/x-midi;audio/x-wav;application/ogg
[storage]
@bear454
bear454 / custom_steps.rb
Created August 12, 2011 23:08
js events in cucumber+capybara+selenium-webdriver...
When /^(?:|I )double-click the card$/ do
snippet = <<-EOS
$(".card[data-id='1']").dblclick();
EOS
page.execute_script( snippet )
end
@bear454
bear454 / tango_palette.css.sass
Created August 16, 2011 16:55
Tango Palette as SASS
//Tango Palette: http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines#Color_Palette
//Licensed as Public Domain
//SASS'd by James Mason ([email protected])
//Butter
$light_butter: #fce94f
$butter: #edd400
$dark_butter: #c4a000
//Orange
@bear454
bear454 / menlo.html
Created October 14, 2013 21:55
'Menlo' font not triggering non-monospaced render on Chrome/Android.
<!doctype html>
<html>
<head>
<style>
.monospace {
font-family: Menlo, Monaco, "Droid Sans Mono", Consolas, "Lucida Console", "Courier New", monospace;
}
.monospace_without_menlo {
font-family: Monaco, "Droid Sans Mono", Consolas, "Lucida Console", "Courier New", monospace;
@bear454
bear454 / gnome-music-all-albums.patch
Last active December 26, 2015 03:58
Tell gnome-music to load *all my albums*.
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 13d77f0..0d8983b 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -87,7 +87,7 @@ class Grilo(GObject.GObject):
def populate_artists(self, offset, callback):
self.populate_items(Query.ARTISTS, offset, callback)
- def populate_albums(self, offset, callback, count=50):
+ def populate_albums(self, offset, callback, count=-1):
1
00:00:00,000 --> 00:00:00,800
Gravel.
2
00:00:00,900 --> 00:00:01,900
WARNING UNEXPECTED TAKEOFF
3
00:00:02,000 --> 00:00:04,000
@bear454
bear454 / dot-net-guid.rb
Created February 25, 2014 21:18
.net is *evil*: example.
# Convert a string in the expected format, into 16 bytes, emulating .Net's
# Guid constructor.
# "00000000-0000-0000-0000-000000000000" =>
# [CLSCompliantAttribute(false)]
# public Guid(
# uint a,
# ushort b,
# ushort c,
# byte d,
# byte e,
@bear454
bear454 / original.rb
Created May 27, 2014 17:02
conference date string refactor
def conference_date_string(conf)
startstr = "Unknown - "
endstr = "Unknown"
# When the conference in the same motn
if conf.start_date.month == conf.end_date.month and conf.start_date.year == conf.end_date.year
startstr = conf.start_date.strftime("%B %d - ")
endstr = conf.end_date.strftime("%d, %Y")
elsif conf.start_date.month != conf.end_date.month && conf.start_date.year == conf.end_date.year
startstr = conf.start_date.strftime("%B %d - ")
endstr = conf.end_date.strftime("%B %d, %Y")
@bear454
bear454 / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="linuxtycooon-app">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;