Skip to content

Instantly share code, notes, and snippets.

@fguillen
fguillen / MyReachability.m
Created February 10, 2010 08:29
iPhone Reachability minimal version
// Reachability Objective-C minimal version
// I'm new so memory leaks are possible on this code
// Extracted from:
// http://www.idevapps.com/forum/archive/index.php/t-3329.html
// (look for an imported_kelvin's post)
//
+ (BOOL)networkAvailable{
SCNetworkReachabilityRef netreach;
SCNetworkConnectionFlags flags;
@fguillen
fguillen / exception_notifier_integration_test.rb
Created May 3, 2010 13:27
Integration Test for ExceptionNotifier
# Integration Test for ExceptionNotifier
# Please change this values for your own purposes:
# * UsersController
# * users_path
#
# Author: http://fernandoguillen.info
#
require 'test_helper'
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement
Please fork, tweet about, etc.
----
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?
God::Contacts::Email.defaults do |d|
d.from_email = 'god@ilefante.es'
d.delivery_method = :sendmail
end
God.contact(:email) do |c|
c.name = 'fguillen'
c.group = 'admins'
c.to_email = 'fguillen.mail+god@gmail.com'
end
# application_controller.rb
before_filter :set_locale
private
def set_locale
new_locale = params[:locale] || cookies[:locale] || extract_locale_from_accept_language_header || I18n.default_locale
if I18n.available_locales.include?( new_locale.to_sym )
I18n.locale = new_locale
From 4b8ac1aa47900037d31896e3564568510b3fd879 Mon Sep 17 00:00:00 2001
From: Fernando Guillen <fguillen.mail@gmail.com>
Date: Tue, 17 Aug 2010 19:07:55 +0200
Subject: [PATCH] Alert if trying to create an empty Quote
---
public/stylesheets/screen.css | 11 ++++++++++-
quotes.rb | 31 +++++++++++++++++++++++++++----
spec/adding_quotes_spec.rb | 17 +++++++++++++++++
spec/amending_quotes_spec.rb | 17 +++++++++++++++++
require 'rubygems'
require 'test/unit'
require 'mustache'
class MustacheNestedTest < Test::Unit::TestCase
def test_nested_section_with_same_member_name
template = <<template
{{#mothers}}
{{name}}: {{#children}}{{name}}({{name}}) {{/children}}|
{{/mothers}}
@fguillen
fguillen / git_tips.md
Created December 19, 2010 20:53
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@fguillen
fguillen / text_block_links_activators.rb
Created March 13, 2011 21:13
active all the detected links in text block (for Ruby)
require 'rubygems'
require 'test/unit'
require 'mocha'
class MyMochaTest < Test::Unit::TestCase
def test_exceptation
string = 'wadus string'
string.expects( :downcase )
assert true
end