Skip to content

Instantly share code, notes, and snippets.

😎

Adan Alvarado aalvarado

😎
Block or report user

Report or block aalvarado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aalvarado
aalvarado / inject_images.js
Created Oct 14, 2010
js way of injecting images in li's
View inject_images.js
function addImages(){
var els = document.getElementsByTagName("ul"); //the parent elements we want to inject
var cssClass='list-package'; //the class we want to target
var code = '<img class="checks2" src="images/check2.png" alt="Check"/>';
for(x in els){
if ( els[x].nodeType === 1) { //checks that its a valid node for the getattribute to work
if(els[x].getAttribute('class') == cssClass){ //verfies that it has the class we want
@aalvarado
aalvarado / changeLineRecorded.py
Created Oct 27, 2010
Snippet from my record line file for pythonscript plugin in n++
View changeLineRecorded.py
class FilePosition:
def __init__(self, bufferId):
self.bufferId = bufferId #sets the bufferId
self.filePositions = [] # where the modified lines will be stored
self.lastPos = 0
self.counter = 0
def addFilePosition(self, pos):
self._findDelete(pos) # checks if the line number is already in the list
@aalvarado
aalvarado / regex insde tags
Created Mar 28, 2011
regex match any not self closing tag content (must be wellformed)
View regex insde tags
(?<=\>)[^<|>]+(?=\<)
@aalvarado
aalvarado / json req
Created Apr 5, 2011
json req using yql
View json req
$.getJSON(
request_url,
function(data){
var link;
var p;
@aalvarado
aalvarado / namespace_encapsulation.js
Created Apr 20, 2011
namespace and object encapsulation in js
View namespace_encapsulation.js
/*
sources:
http://www.justatheory.com/computers/programming/javascript/emulating_namespaces.html
http://www.dustindiaz.com/namespace-your-javascript/
http://www.crockford.com/javascript/private.html
http://yuiblog.com/blog/2007/06/12/module-pattern/
http://stackoverflow.com/questions/881515/javascript-namespace-declaration
*/
@aalvarado
aalvarado / reabase-on-upstream
Created Sep 29, 2011
bashscript for rebasing on upstream master.
View reabase-on-upstream
#!/bin/sh
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
current_branch=$(parse_git_branch)
if [[ -n "$current_branch" ]]; then
git fetch -v upstream
git checkout master
@aalvarado
aalvarado / .bashrc
Last active Sep 27, 2015
.bash_profile
View .bashrc
# Probaby windows with msys (old times)
alias ls='ls -A --color=yes'
alias dir='ls -A --color=yes'
alias vi='vim'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gfu='git fetch upstream master:upstream'
alias gf='git fetch origin master:remote-master'
alias gp='git push'
@aalvarado
aalvarado / form_loader_replacer.js
Created Feb 24, 2012
jquery button form loader replacer
View form_loader_replacer.js
var form_button_helper = function(){
var loader_image_url = '';
var loader_image = $( document.createElement('img') )
.attr(src, loader_image_url)
.class('form_loader');
return{
toggle_loader : function( button ){
$( button ).toggle();
}
@aalvarado
aalvarado / texplay_on_windows.txt
Created Feb 27, 2012
texplay install on windows
View texplay_on_windows.txt
copy : libfreeglut.a and libfreeglut_static.a to C:\Ruby187\lib
copy GL folder to C:\Ruby187\lib\ruby\1.8\i386-mingw32
You can’t perform that action at this time.