Skip to content

Instantly share code, notes, and snippets.

@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot');
}
@font-face {
font-family: 'icomoon';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg6v8ywAAAC8AAAAYGNtYXDgfOaMAAABHAAAAERnYXNwAAAAEAAAAWAAAAAIZ2x5ZlRMFxoAAAFoAAA6WGhlYWQASAk3AAA7wAAAADZoaGVhB8ID+wAAO/gAAAAkaG10eOIADMUAADwcAAAA6GxvY2GdD5AIAAA9BAAAAHZtYXhwAEMBLQAAPXwAAAAgbmFtZUQXtNYAAD2cAAABOXBvc3QAAwAAAAA+2AAAACAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAACDmAgPA/8D/wAPAAEAAAAAAAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADAAAAAIAAgAAgAAACDgNOYC//8AAAAg4ADmAP///+EgAho3AAEAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQBRABEDrgNuAFMAAAEuASIGBwEOARQWFx4BMjY3AT4BNCYnLgEiBg8BDgEUFhceATI2PwE+ATIWFx4BFAYHAQ4BIiYnLgE0NjcBPgEyFhceARQGDwEeAxc3PgE0JicDrihmamYp/isoKCgoKWZqZigBIBkZGRkZP0I/GbQKCgoKCRcYFwm1BhAQEAYGBgYG/uAWNzk3FhYWFhYB1RY3OTcWFhYWFgQLEQwHAS4pKSkpA24pKSkp/isoZmpmKSgoKCgBIBk/Qj8ZGRkZGbUJFxgXCQoKCgq0BgYGBgYQEBAG/uEWFhYWFjc5NxYB1RYWFhYWNzk3FgQPICIjEi4pZmpmKAA
if (
and (
YEAR(Date_Start__c) == YEAR(TODAY()),
IF(
CEILING( ( Date_Start__c - DATE( YEAR( Date_Start__c ), 1, 1) + 1) / 7) > 52,
52,
CEILING( ( Date_Start__c - DATE( YEAR( Date_Start__c ), 1, 1) + 1) / 7)
) ==
IF(
71: # create an ad
72: # create_ad(oid, cid, n, mpid, sd, ed, d, vinit, vaud, vlang, pltyp, ct, pdev, arc, params = {})
73: gmt_start = DateTime.parse("2014-1-26").to_time.to_i #+ offset_in_seconds
74: gmt_end = DateTime.parse("2014-1-31" + 'T23:59:00').to_time.to_i
75: new_add = mash(@adap.create_ad("6482","44810", "Best Test Ad Ever!", "33", gmt_start, gmt_end, "15", "AUTO", "YES", "ENGLISH", "GAME_PLAYER", "PRO", "ANY", "VIDEO"))
=> 76: binding.pry
77: end
78: end
[1] pry(#<AdapMiddleware::App>)> gmt_start

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@noeticpenguin
noeticpenguin / switch.rb
Created May 12, 2011 15:32 — forked from jbr/switch.rb
ruby 1.9.2 case-like switch
# In response to:
# http://mlomnicki.com/ruby/tricks-and-quirks/2011/02/10/ruby-tricks2.html
# Ruby 1.9.2 has some neat stuff that lets us make a readable
# alternative case statement that calls each method in turn.
# 1.9.2 features used:
# * hashes are ordered in 1.9.2
# * cool JSON-style hash syntax
# * concise lambda syntax
@noeticpenguin
noeticpenguin / gist:1242452
Created September 26, 2011 15:09 — forked from ndbroadbent/gist:1218804
ruby1.9.2-p290 w/ Require performance patch.
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > /tmp/ruby-1.9.2p290.patch
rvm install ruby-1.9.2-p290 --patch /tmp/ruby-1.9.2p290.patch
@noeticpenguin
noeticpenguin / gist:1428039
Created December 3, 2011 20:20 — forked from jonathanpenn/gist:1428002
Blip prompt
# Prompt Setup
YELLOW='\[\033[1;33m\]'
BLUE='\[\033[1;34m\]'
GREEN='\[\033[1;32m\]'
RED='\[\033[0;31m\]'
NORMAL='\[\033[00m\]'
WHITE='\[\033[0;37m\]'
function minutes_since_last_commit {
@noeticpenguin
noeticpenguin / mr_status_bar_app.rb
Created December 15, 2011 12:13 — forked from rubiojr/mr_status_bar_app.rb
MacRuby StatusBar Application
#
# Initialize the stuff
#
# We build the status bar item menu
def setupMenu
menu = NSMenu.new
menu.initWithTitle 'FooApp'
mi = NSMenuItem.new
mi.title = 'Hellow from MacRuby!'
mi.action = 'sayHello:'
@noeticpenguin
noeticpenguin / PaddedTextFieldCell.rb
Created January 1, 2012 23:07 — forked from micahbrich/PaddedTextFieldCell.rb
Awesome Text Fields in MacRuby
class PaddedTextFieldCell < NSTextFieldCell
def drawingRectForBounds(cellFrame)
super
result = cellFrame
padding_left = (result.size.width / 16).round # to make sure text is clear
padding_top = (result.size.height / 4).round
result.origin.x += padding_left
result.origin.y += padding_top