Skip to content

Instantly share code, notes, and snippets.

View joemocha's full-sized avatar
🎯
Focusing

joemocha

🎯
Focusing
View GitHub Profile
@joemocha
joemocha / home.html
Created February 12, 2014 20:55
google ad for the frontpage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
// <![CDATA[
/*
App Data
Changeable
*/
@joemocha
joemocha / symbol_vs_string.rb
Created August 19, 2014 00:56
Benchmark for comparing symbol and string usage
require 'benchmark'
str = Benchmark.measure do
10_000_000.times do
"test"
end
end.total
sym = Benchmark.measure do
10_000_000.times do
@joemocha
joemocha / designer.html
Created October 17, 2014 03:22
designer
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
begin
address = EasyPost::Address.create(
:name => 'Test Person',
:street1 => '15 TANGUAY AVENUE',
:city => 'Nashua',
:state => 'NH',
:zip => '03062',
:country => 'US',
:phone => '201-273-8374',
:residential => false
# The GraphicsMagick action, dependent on the `gm` command, is able to perform
# any number of GraphicsMagick conversions on an image passed in as an input.
# The options hash should specify the +name+ for the particular step (which is
# appended to the resulting image filename) the +command+ (eg. convert, mogrify),
# the +options+ (to the command, eg. -shadow -blur), and the +extension+ which
# will determine the resulting image type. Optionally, you may also specify
# +input+ as the name of a previous step; doing this will use the result of
# that step as the source image, otherwise each step uses the original image
# as its source.
class GraphicsMagick < CloudCrowd::Action
@joemocha
joemocha / Gemfile
Created February 19, 2010 20:55
interesting setup
# encoding: utf-8
source :gemcutter
source 'http://gems.github.com'
# Rails 2.x style.
group :rails do
gem 'rails', '~> 2.3.5', :require => nil
gem 'builder', '~> 2.1.2'
gem 'memcache-client', '>= 1.7.4', :require => nil
gem 'tzinfo', '~> 0.3.12'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
DB = {
:redis => SITE_REDIS,
:geo => GEO
}
SITES = DB[:redis].smembers("sites").inject({}) do |sum, site|
sum[site] = JSON.parse(DB[:redis]["site:#{site}"])
sum
end
module FCG
module Client
module Comment
# sort attributes
ATTRIBUTES = [:site, :record, :body, :body_as_html, :deleted, :flagged_by, :depth, :path, :parent_id, :displayed_name, :user_id]
module ClassMethods
end
class CommentsController < ApplicationController
before_filter :require_user
def index
@comments = Comment.all
end
def new
end