Skip to content

Instantly share code, notes, and snippets.

View PabloVallejo's full-sized avatar

Pablo Vallejo PabloVallejo

View GitHub Profile
  1. Copy the path of git and asign it to the path like "C:\Program Files (x86)\Git\bin" Tip: Copy the path from the shortcut in the desktop

@PabloVallejo
PabloVallejo / shell-loops.sh
Created January 15, 2013 01:38
Shell loops
#!/bin/bash
# Basic For Loop
for file in ${_BadMaps[*]}
do
echo "$file"
end
<php
$string = "This is a sample paragraph, it happens to be very long and I want add a space every 20 characters";
echo chunk_split( $string, 20, ' ' );
<?php
/**
* Embed Disqus in Static template
* Taken from http://wp.tutsplus.com/tutorials/plugins/integrating-disqus-into-wordpress/
*
* @param { string } disqus shortname
*/
function disqus_embed( $disqus_shortname ) {
global $post;
// User model
//--------------------
models.User = Backbone.Model.extend({
defaults: {
id: 0
, username: ''
}
<?php
$GLOBALS['wp_tests_options'] = array(
'active_plugins' => array( 'post-forking/post-forking.php' ),
);
# Antes que nada, haga commit de sus cambios
git add .
git commit -m "Descripcion del commit."
# Luego baje los ultimo del master en el server
git pull origin master
# Ahora si puede subir sus commits al server
git push origin nombre-de-su-branch
// Dependencies.
var express = require('express'),
app = module.exports = express.createServer(),
del = function(req, res) { res.clearCookie('login_token'); res.redirect('/'); },
set = function(req, res) { res.cookie('login_token', +new Date(), { maxAge: 3600000, path: '/' }); res.redirect('/'); };
// Config
app.configure(function() {
app.use(express.bodyParser());
app.use(express.cookieParser());
@PabloVallejo
PabloVallejo / call-apply.js
Created May 9, 2013 01:53
Sample of call and apply methods
// Person
var Person = function( firstName, lastName ) {
// Asign attributes
this.first_name = firstName;
this.last_name = lastName;
// Say name method
this.sayName = function() {
@PabloVallejo
PabloVallejo / git-cheat.sh
Created June 8, 2013 19:47
Useful tasks that may necessary when using git.
# Remove cached repository in order to .gitignore to take effect after
# several commit have been made.
git rm -r --cached .
git add .
git commit -m "Removed cached repository, now .gitignore should work fine."