Now a gem!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Start Plex if not running. Make fullscreen if running windowed. Quit if running fullscreen. | |
-- By Henrik Nyh <http://henrik.nyh.se> 2009-11-22 under the MIT License. | |
-- Some code from http://forums.plexapp.com/index.php?/topic/8325-applescript-focusfullscreen-plex/ | |
tell application "Plex" | |
-- "if it is running" is probably Snow Leopard only. | |
if it is running then | |
tell application "System Events" to tell process "Plex" | |
set isFullscreen to position of window 1 is {0, 0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get exchange rate as JSONP via YQL. | |
YQL Console: http://developer.yahoo.com/yql/console | |
Query (USD to SEK): select rate,name from csv where url='http://download.finance.yahoo.com/d/quotes?s=USDSEK%3DX&f=l1n' and columns='rate,name' | |
Example code: | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:location.pathname=location.pathname.replace(/\/detail\/(\w+).*/, '/developer/edit/$1'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Fluid.app URL Pattern: http://www.google.tld/reader/* | |
*/ | |
#gbar, .gbh, #viewer-footer { display: none !important; } | |
#global-info { top: 3px !important; right: 180px !important; z-index: 999; opacity: 0.1 } | |
#global-info:hover { opacity: 1 } | |
#global-info a { text-decoration: none } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/locales/en.yml | |
en: | |
i18n: | |
language: | |
name: 'English' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/monkeypatches.rb | |
# Work around a Rails bug where e.g. :include => :foo, :conditions => { :'foo.bar' => 'baz' } | |
# would not include 'foo' unless 'foo.bar' is a string. | |
# https://rails.lighthouseapp.com/projects/8994/tickets/2998-named_scope-ignores-include-option | |
module ActiveRecord::Associations::ClassMethods | |
def tables_in_hash(hash) | |
return [] if hash.blank? |
Skrapa föremålsinformation från sökresultat på http://www.blocket.se. Parsa ofullständiga datumtider.
Filen imac.html är resultatet av en sökning på "imac" i Stockholm utförd 2010-01-27.
Skriv kod för att extrahera föremålsdata till en nästlad array. Tiden bör vara en Time
, rubriken en String
i UTF8 och priset en Integer
.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YAMLator by Henrik Nyh <http://henrik.nyh.se> 2010-02-03 under the MIT license. | |
# Helps you update Rails i18n YAML files programmatically, to be used e.g. for | |
# editor extraction tools. | |
$KCODE = 'u' | |
require "yaml" | |
require "rubygems" | |
require "ya2yaml" # Dumps with unescaped UTF-8. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/i18n.rb | |
# Globalize 1 compatibility. To be refactored away. | |
class GlobalizeTranslation < ActiveRecord::Base; end | |
class Globalize::ViewTranslation < GlobalizeTranslation; end | |
LANGUAGE_ID_EN = 1819 | |
class String |