Skip to content

Instantly share code, notes, and snippets.

View jorgeas80's full-sized avatar
🎯
Focusing

Jorge Arévalo jorgeas80

🎯
Focusing
View GitHub Profile
@jorgeas80
jorgeas80 / command_line_tricks.md
Last active August 29, 2015 14:27
Nice command line tricks

Show just the commits done to a git branch, when this branch has been already merged into master/develop

git log mybranch --not $(git for-each-ref --format='%(refname)' refs/heads/ | grep -v "refs/heads/mybranch")

Vim automatically adds a newline character at the end of a file, and this causes git diff showing it. We can get rid of this character by doing this

perl -pi -e 'chomp if eof' filename
@jorgeas80
jorgeas80 / logging_level.py
Created October 12, 2015 14:20
Logging level trick in Python
# Trick from https://www.reddit.com/r/Python/comments/3nctlm/what_python_tools_should_i_be_using_on_every
# The logging levels are actually integers with a 10 increment (DEBUG is 10, CRITICAL is 50)
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('-q', '--quiet', action='count', default=0)
logging_level = logging.WARN + 10*args.quiet - 10*args.verbose
# script -vv -> DEBUG
# script -v -> INFO
# script -> WARNING
@jorgeas80
jorgeas80 / makeRadiosDeselectableByName.js
Created December 29, 2015 14:57
Make radio button deselectable
var makeRadiosDeselectableByName = function(name){
$('input[name=' + name + ']').click(function() {
if($(this).attr('previousValue') == 'true'){
$(this).attr('checked', false)
} else {
$('input[name=' + name + ']').attr('previousValue', false);
}
$(this).attr('previousValue', $(this).attr('checked'));
});
@jorgeas80
jorgeas80 / bs-container
Created February 26, 2016 18:02
My code snippets for Brackets (created using https://github.com/zaggino/brackets-snippets)
<div class="container{{$1?:optionalClasses}}">
{{!cursor}}
</div>
@jorgeas80
jorgeas80 / LINKS_BOOTSTRAP.md
Last active March 21, 2016 12:59
Enlaces curso Bootstrap
@jorgeas80
jorgeas80 / brackets-plugins.md
Last active March 7, 2016 22:30
Brackets plugins I use

Those are the plugins I use in Brackets editor, in alphabetical order

@jorgeas80
jorgeas80 / gist:62fa5145f2eb6ab1192f7b4905b4c9e4
Created April 12, 2016 11:09 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

<?php
// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);
// connect to the mysql database
$link = mysqli_connect('localhost', 'user', 'pass', 'dbname');
mysqli_set_charset($link,'utf8');