Skip to content

Instantly share code, notes, and snippets.

View juanghurtado's full-sized avatar
🙄

Juan G. Hurtado juanghurtado

🙄
View GitHub Profile
@juanghurtado
juanghurtado / qrcode.js
Created July 9, 2012 06:39
Appcelerator QR Code VCard error
// TESTED WITH APPCELERATOR TITANIUM 2.1.0.GA
// Method by Dawson Toth:
// http://developer.appcelerator.com/blog/2011/09/qr-codes-in-your-mobile-apps-cross-platform.html
function createQRCodeImageView(text, size) {
var url = 'http://chart.apis.google.com/chart?cht=qr&chs=' + size + '&chl=' + encodeURI(text) + '&chld=H|0';
var width = size.split('x')[0], height = size.split('x')[1];
if (Ti.Android) {
width += 'dp';
height += 'dp';
@juanghurtado
juanghurtado / sample.js
Created June 18, 2012 16:35
Backbone.Marionette ItemView triggers
// Model
module.SampleModel = Backbone.Model.extend({});
// View
module.SampleView = Backbone.Marionette.ItemView.extend({
template : template_string,
// This trigger runs only the first time. After that, "click" event is not triggered (defaults to href="#")
triggers : {
'click .reload' : 'reload'
@juanghurtado
juanghurtado / IndexModule.js
Created June 5, 2012 17:30
Jasmine Sinon Backbone
define(
[
"backbone", "marionette", "jquery",
"modules/app/app",
"text!modules/index/templates/weather.html",
"text!modules/index/templates/multiple.html",
"text!modules/index/templates/loading.html"
],
function(Backbone, Marionette, $, App, weatherTpl, multipleTpl, loadingTpl) {
var module = App.module('Index');
@juanghurtado
juanghurtado / media-queries.css
Created April 2, 2012 20:03
CSS3 Media Query Boilerplate
/* ---------------------------------------------------------------------------
Boilerplate CSS Media Queries
Encoding: UTF-8
Author: PaulUnd (http://www.paulund.co.uk/boilerplate-css-media-queries)
--------------------------------------------------------------------------- */
/* =Smartphones (portrait and landscape)
--------------------------------------------------------------------------- */
@media only screen
@juanghurtado
juanghurtado / changepage.js
Created March 22, 2012 09:04
$.mobile.changePage() fail on PhoneGap/Cordova 1.5.0
(function() {
$('#new-town').bind('pagebeforeshow', function(event) {
$('a.my_link').bind('click', function(event) {
$.ajax({
contentType: 'application/x-www-form-urlencoded',
type: 'POST',
url: 'http://example.com/rest/sample',
data: sample_params,
success: function(data) {
console.log('Ajax request is nice!');
@juanghurtado
juanghurtado / sample.css
Created March 2, 2012 10:56
Replace -9999px CSS hack
.hide-text {
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
}
@juanghurtado
juanghurtado / wottam.rb
Created March 1, 2012 11:58
Wottam description
def wottam
"AWESOME!"
end
@juanghurtado
juanghurtado / sample_backup.rb
Created February 24, 2012 20:41
Sample config for Backup Ruby gem
Backup::Model.new(:sample_backup, 'A sample backup configuration') do
split_into_chunks_of 4000
database MySQL do |database|
database.name = 'my_sample_mysql_db'
database.username = 'my_username'
database.password = 'my_password'
database.skip_tables = ['logs']
database.additional_options = ['--single-transaction', '--quick']
@juanghurtado
juanghurtado / gist:1875830
Created February 21, 2012 10:57
Ignore files at TODO TextMate bundle
Add a shell variable called `TM_TODO_IGNORE`, with a regEx value like: `jquery.mobile.1.0.js|phonegap.js|jquery-1.6.4.js|jquery.mobile.js`
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0"
id="com.viavansi"
version="0.2">
<!-- Info -->
<name>PhoneGap Sample</name>
<description>
PhoneGap API Sample