Skip to content

Instantly share code, notes, and snippets.

View jacoborus's full-sized avatar

Jacobo Tabernero jacoborus

View GitHub Profile
@jacoborus
jacoborus / archive.php
Created April 10, 2012 16:53
Archive.php de wordpress muy básico
<?php get_header(); ?>
<div class="container central">
<div class="row">
<section class="archive nine columns">
<?php if (have_posts()) : ?>
<h1>Noticias de <?php the_time('F, Y'); ?></h2>
<?php while (have_posts()) : the_post(); ?>
@jacoborus
jacoborus / loadimagejquery.js
Created April 11, 2012 03:11
Cargar imagen con jQuery
var img = $('<img/>').load(function() {
// Loading done ..
img.appendTo("#imagePopup .content");
}).error(function(){
// Unable to load image ..
$("#imagePopup .content").html('Image failed to load.');
}).attr('src', imageSource);
@jacoborus
jacoborus / slug.js
Created April 11, 2012 03:19 — forked from bentruyman/slug.js
JS. Slug Generator - muy simple
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@jacoborus
jacoborus / screenOrientationIOs.js
Created June 14, 2012 17:58
Detect screen orientation on iOs
function doOnOrientationChange(){
switch(window.orientation) {
case -90:
case 90:
alert('landscape');
break;
default:
alert('portrait');
break;
}
@jacoborus
jacoborus / getBrowserResol.js
Created July 30, 2012 02:39
Get browser screen resolution all platforms
// http://www.digimantra.com/technology/javascript/detect-screen-or-browser-size-in-javascript/
function getWidth()
{
xWidth = null;
if(window.screen != null)
xWidth = window.screen.availWidth;
if(window.innerWidth != null)
xWidth = window.innerWidth;
@jacoborus
jacoborus / protege.php
Created November 2, 2012 09:02
Proteger PHP frente a inyecciones
<?php
function protege($texto) {
$texto = str_replace("'", "\'", $texto);
$texto = htmlspecialchars ($texto);
$texto = htmlentities ($texto);
$texto = trim ($texto);
@jacoborus
jacoborus / letterbyletter.js
Created November 8, 2012 00:16
Simple jQuery/Zepto plugin for typing character by character texts
/**
* jQuery.letterByLetter
* Version 0.3.0
*
* Simple jQuery/Zepto plugin for typing character by character texts
* Standard call:
$('.myDivs').LetterByLetter({
'speed' : 150
});
@jacoborus
jacoborus / Monokai Pastel.tmTheme
Created May 7, 2013 08:08
Sublime Text color scheme - Monokai Pastel
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai Pastel</string>
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');