Skip to content

Instantly share code, notes, and snippets.

@exegeteio
exegeteio / Gemfile
Last active August 29, 2015 14:05
i18n Gemfile
gem 'rails-i18n', '~> 4.0.0'
## Gives javascript access to translations.
gem "i18n-js"
@exegeteio
exegeteio / config.rb
Created August 20, 2014 23:27
i18n config.rb
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.i18n.default_locale = "en-US"
config.i18n.available_locales = ["es-MX", "en-US"]
config.assets.initialize_on_precompile = true
@exegeteio
exegeteio / routes.rb
Last active August 29, 2015 14:05
i18n routes.rb
root to: redirect("/#{I18n.default_locale}", status: 302), as: :redirected_root
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
resources :users
end
@exegeteio
exegeteio / aplication_controller.rb
Created September 4, 2014 02:43
ApplicatController
class ApplicationController < ActionController::Base
before_filter :prepare_for_mobile
private
## Is this a mobile device?
def mobile_device?
if session[:mobile_param]
session[:mobile_param] == "1"
else
request.user_agent =~ /Mobile|webOS/
@exegeteio
exegeteio / application.rb
Created September 4, 2014 03:08
Application config from YAML.
begin
ENV.update YAML.load_file('config/mio.yml')[Rails.env]
rescue => e
logger.fatal "Failed to load MIO YAML file: #{e.message}"
end
@exegeteio
exegeteio / mio.yml
Created September 4, 2014 03:09
MIO Config file.
development: &development
mio_api_url: "http://localhost:9004/api/"
mio_api_username: "test_username"
mio_api_key: "super secret key"
test:
<<: *development
production:
mio_api_url: "https://top_secret.url/api/"
@exegeteio
exegeteio / Gara Target Macro
Last active August 29, 2015 14:12
Macro for targeting the mobs needed in the Gara Quest (http://eyesofthebeast.com/2014/09/gara-spirit-beast-epic-taming-quest/)
/cleartarget
/tar Drywind Bonepicker
/tar Gorebound Legionnaire
/tar Sethekk Prophet
/tar Warsong Marauder
/tar Necrophyte
/tar Thunderlord Giantslayer
/tar Shadowmoon Voidtwister
/stopmacro [@target,noexists]
/tm 8
@exegeteio
exegeteio / quiz-test.coffee
Created January 29, 2015 14:25
Testing Meteor Methods with TinyTest and describe.
class Quiz
constructor: (@quizCollection) ->
create: (description, options) ->
check description, String
check options, Array
if options.length is 0
throw new Meteor.Error('Must specify options.')
@quizCollection.insert {
description: description,
options: options,
@exegeteio
exegeteio / twitch_status.html
Last active July 16, 2021 18:01
Twitch online status
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script>
var checkStatus = function(streamer, $span) {
jQuery.getJSON('https://api.twitch.tv/kraken/streams/' + streamer + '/?callback=?', function(json) {
if (json.stream) {
$span.html($span.attr('data-twitch-online'));
} else {
$span.html($span.attr('data-twitch-offline'));
@exegeteio
exegeteio / test.rb
Created April 25, 2016 20:28
Testing YAML output with Ruby.
#!/usr/bin/ruby
require 'yaml'
puts YAML.load_file('test.yaml').inspect