Skip to content

Instantly share code, notes, and snippets.

@carloespinosa
carloespinosa / introrx.md
Created July 19, 2016 04:42 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
/**
* called when an item in the ListView is clicked; we will get the section
* index, and addition event information
*
* @param {Object} _event
*/
function loadMoreBtnClicked(_event) {
alert('not implemented yet');
}
#error_explanation {
width: 400px;
border: 2px solid red;
padding: 7px;
padding-bottom: 12px;
margin-bottom: 20px;
background-color: #f0f0f0;
}
#error_explanation h2 {
@carloespinosa
carloespinosa / Ruby Hash inflections
Created February 18, 2013 05:16
Ruby Hash Inflections
Hash.class_eval do
def seek(*_keys_)
last_level = self
sought_value = nil
_keys_.each_with_index do |_key_, _idx_|
if last_level.is_a?(Hash) && last_level.has_key?(_key_)
if _idx_ + 1 == _keys_.length
sought_value = last_level[_key_]
else
@carloespinosa
carloespinosa / WSO2 WSF C framework and Ruby C extensions
Last active December 12, 2015 09:48
Installation of the old WSO2 WSF/C framework and Ruby C extensions in Mac OS X 10.8.2, GCC 4.2 by source with Homebrew. Also updated deprecated C syntax definitions in some of the Ruby C Extensions.
WSO2 WSF/C
http://dist.wso2.org/products/wsf/c/2.0.0/wso2-wsf-c-src-2.0.0.zip
1) brew install libxml-2
2) brew link libxml2
3) brew install autoconf
# Remove the "-Wno-long-double" command line function in the config files since newer gcc (4.2) versions don't support this anymore.
4) grep -rl "\-Wno\-implicit\-function\-declaration" . | xargs perl -pi -e 's/-Wno-implicit-function-declaration//'
5) grep -rl "\-Wno\-long\-double" . | xargs perl -pi -e 's/-Wno-long-double//'
6) ./configure --prefix=/opt/wso2/wsf_c CC="gcc-4.2" CXX="g++-4.2" CPPFLAGS="-DHAVE_GETIFADDRS"
7) make
@carloespinosa
carloespinosa / deploy.rb
Created December 3, 2012 10:53 — forked from benmoss/deploy.rb
Configuring a remote sphinx server with Thinking Sphinx
# deploy.rb
namespace :ts_remote do
task :conf do
run <<-CMD
cd #{current_release}
&&
RAILS_ENV=#{rails_env} rake ts:conf
&&
rsync --progress #{current_release}/config/#{rails_env}.sphinx.conf sphinxsearch@db-server:/home/sphinxsearch/