Skip to content

Instantly share code, notes, and snippets.

@fguillen
fguillen / sms_sender.rb
Created May 2, 2011 11:00
sending SMS by OVH
require 'soap/wsdlDriver'
class SMSSender
def self.send( phone, text )
Rails.logger.info( "sending sms [#{phone}]: '#{text}'")
wsdl = 'http://www.ovh.com/soapi/soapi-re-1.18.wsdl'
soapi = SOAP::WSDLDriverFactory.new( wsdl ).create_rpc_driver
session =
require 'rubygems'
require 'test/unit'
require 'mocha'
class MyMochaTest < Test::Unit::TestCase
def test_exceptation
string = 'wadus string'
string.expects( :downcase )
assert true
end
@fguillen
fguillen / text_block_links_activators.rb
Created March 13, 2011 21:13
active all the detected links in text block (for Ruby)
@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 "[email protected]"

Repository git user

cd /develop/myrepo

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}}
From 4b8ac1aa47900037d31896e3564568510b3fd879 Mon Sep 17 00:00:00 2001
From: Fernando Guillen <[email protected]>
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 +++++++++++++++++
# 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
God::Contacts::Email.defaults do |d|
d.from_email = '[email protected]'
d.delivery_method = :sendmail
end
God.contact(:email) do |c|
c.name = 'fguillen'
c.group = 'admins'
c.to_email = '[email protected]'
end
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?
@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'