Skip to content

Instantly share code, notes, and snippets.

View rolandoam's full-sized avatar

Rolando Abarca rolandoam

View GitHub Profile
(module dotenv
(dotenv/load)
(import
scheme
chicken.base
chicken.string
chicken.process-context
chicken.io
#!/usr/bin/env ruby
if ARGV.size < 3
puts "usage: #{__FILE__} <start_no> <end_no> <output_dir> [quality]"
exit 1
end
start_no = ARGV[0].to_i
end_no = ARGV[1].to_i
output_dir = ARGV[2]
@rolandoam
rolandoam / gist:789df44adf67450f8461
Last active August 29, 2015 14:01
text buttons & actions in play-clj
(defscreen main-screen
:on-show
(fn [screen entities]
(let [ui-skin (skin "uiskin.json")
;;; this is the trick, we use a proxy (http://clojure.org/java_interop#toc25) to implement a ClickListener
cb (proxy [ClickListener] []
;;; for this object, we only care about 'clicked'
(clicked [evt x y] (println "clicked at " x y evt)))]
(update! screen :renderer (stage) :camera (orthographic))
;;; add a couple of entities to the screen. We could've used a table here, but
@rolandoam
rolandoam / Rakefile
Created July 30, 2013 01:44
Rakefile for Teensy 3.0
require "json"
require "rake/clean"
if File.exists?("project.json")
CONFIG = JSON.parse(File.read("project.json"))
else
CONFIG = {}
end
CONFIG["target"] ||= "main"
// MyDelegate.m
-(void)vungleMoviePlayed:(VGPlayData*)playData
{
// movie ad finished, get times from playData
if ([playData playedFull]) {
// give reward to user
}
}
// This is the code that initializes vungle
require 'rubygems'
require 'pp'
# you need these two gems, so `gem install` them before
require 'linode'
require 'aws-sdk'
API_KEY="YOUR_LINODE_KEY"
# create a simple domain and add a record to it
# make sure you have the env variables AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY set before running this
/**
* the simplest unit testing framework. Compatible with require.js by Rolando
* Abarca (2013) - https://gist.github.com/funkaster/5264666
*
* This is public domain, do whatever you want with this. I'm not responsible if
* something does not work the way you want. Feel free to send pull requests to
* this gist.
*
* usage:
*
@rolandoam
rolandoam / Makefile
Created March 19, 2013 19:15
makefile for both native and emscripten projects: make js # will make the js port, output a projectname.js make native # will compile the native port, output project.native make sure there are no important files named `project.*` because they will be cleaned by the `clean` target
EMSCRIPTEN_HOME = ~/Documents/inbox/emscripten
PROJECT = myproject
SOURCES = $(wildcard *.cc) $(wildcard *.c)
OBJECTS = $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(SOURCES)))
set-native:
$(eval CXX := clang -x c++)
$(eval CC := clang)
$(eval CPPFLAGS := -g -O2 -DHAS_TR1)
@rolandoam
rolandoam / compare.js
Created November 24, 2012 19:25
compare two spanish words
var spanishCharsMap = {
225: 97, // á
233: 101, // é
237: 105, // í
243: 111, // ó
250: 117, // ú
241: 110 // ñ
};
/**
@rolandoam
rolandoam / gist:4109020
Created November 19, 2012 04:43
Conversion from retain/release to smart pointers on C++

About this doc

This is a living doc and is intended to be modified!

Conversion plan

The idea of this doc is to set a minimal conversion guide to pass from the old retain - release - autorelease in cocos2d-x to a more modern, stable and cross-platform shared_ptr, auto_ptr or weak_ptr. The latter will be more friendly to the developer and also similar to what ARC provides in Objective-C

Simple case