This file contains 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
require 'fileutils' | |
RANGE = (0xe000...0xf8ff); | |
def map_fonts(src, map_file) | |
map = { | |
'meta' => { | |
'author' => "Redbubble" | |
}, | |
'font' => { |
This file contains 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
#!/bin/bash | |
getMyIP() { | |
local _ip _myip _line _nl=$'\n' | |
while IFS=$': \t' read -a _line ;do | |
[ -z "${_line%inet}" ] && | |
_ip=${_line[${#_line[1]}>4?1:2]} && | |
[ "${_ip#127.0.0.1}" ] && _myip=$_ip | |
done< <(LANG=C /sbin/ifconfig) | |
printf ${1+-v} $1 "%s${_nl:0:$[${#1}>0?0:1]}" $_myip |
This file contains 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
require 'machinist/active_record' | |
require 'sham' | |
require 'faker' | |
Sham.define do | |
title { Faker::Lorem.words(2).join(' ') } | |
permalink { Faker::Lorem.words(2).join('-') } | |
status(:unique => false) do | |
case(rand(3)) | |
when 0: |
This file contains 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
if Rails.env == 'production' && File.exists?(File.join(Rails.root, 'REVISION')) | |
revision = File.read(File.join(Rails.root, 'REVISION')).strip | |
ActionController::Base.asset_host = "yourcdn.s3.amazon.com/#{revision}" | |
end | |
module Sass::Script::Functions | |
def url(string) | |
if Rails.env == 'production' && File.exists?(File.join(Rails.root, 'REVISION')) | |
revision = File.read(File.join(Rails.root, 'REVISION')).strip | |
path = string.value |
This file contains 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
// Create a file on your desktop, enter the code, and then open it LOCALLY in your browser | |
// This works... | |
var http = new XMLHttpRequest(); | |
var url = "http://www.need-a-real-url.com"; | |
var params = "<data></data>"; | |
http.open("POST", url, true); | |
http.send(params); | |
// This doesn't... |
This file contains 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
require 'test_helper' | |
class SyncTest < Test::Unit::TestCase | |
include TestHelper | |
context 'SyncTest' do | |
setup do | |
setup_context | |
Titanium.include('lib/88miles.js') | |
Titanium.include('lib/sync.js') |
This file contains 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
class SmokeyTheBear | |
def method_missing(symbol, *args) | |
responses = [ :me, :you ] | |
if responses.include?(symbol) | |
what_was_said = symbol.to_s | |
what_was_meant = responses.dup.delete_if { |r| r == symbol }.first.to_s | |
return "You chose '#{what_was_said}' referring to '#{what_was_meant}'. That is incorrect. The correct answer is '#{what_was_meant}'." | |
else | |
super |
This file contains 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
class BaseRecord | |
attr_accessor :values | |
def self.fields(fields) | |
BaseRecord.field_list = fields | |
end | |
def self.field_list=(field_list) | |
@field_list = field_list | |
end |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" > | |
<title>i18n Demo</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/madpilot/jquery-i18n/master/jquery.i18n.js"></script> | |
<script type="text/javascript"> | |
var languages = { | |
en: { |
This file contains 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
jQuery.ajaxSetup( | |
statusCode: { | |
403: function() { | |
// This calls a backbone view that renders a login window, then | |
// calls the success function one the user has been authenticated | |
// The call back simply re-runs $.ajax using the current context object, | |
// which conveniently is a hash of the original AJAX request params. | |
var sessionLogin = new SessionsLoginView(); | |
var context = this; |
OlderNewer