Skip to content

Instantly share code, notes, and snippets.

View tehsis's full-sized avatar
🎯

Pablo Terradillos tehsis

🎯
View GitHub Profile
@tehsis
tehsis / bulk_rename.py
Created February 28, 2011 20:39
Find text inside files and replace them
import os
import re
def replace(file_path, pattern, string):
with open(file_path) as current_file:
with open(file_path + '_new', 'w') as temp_file:
for line in current_file:
new_line = re.sub(pattern, string, line)
temp_file.write(new_line)
os.rename(file_path + '_new', file_path)
@tehsis
tehsis / import.pl
Created June 1, 2011 16:59
SQL Import
#!/usr/bin/perl
use strict;
my $table = shift;
open(my $fh, '<',shift) or die $!;
my $exportfile = shift;
open (FILE,">",$exportfile);
@tehsis
tehsis / simphplegall.php
Created June 1, 2011 17:01
PHP Image gallery
<?php
//--------------------------------
//Simphple Gallery
//Version: 0.1
//Author: tehsis <tehsis@gmail.com>
//Desc: It creates an image gallery from
//a directory containing images files
//--------------------------------
//Modify this variables to fit your needs
@tehsis
tehsis / jquery.dataset.js
Created March 13, 2012 04:52
jQuery plugin which gets the dataset() object of an element even on older browsers.
jQuery.fn.extend({
dataset: function(){
var attributes = {};
if(!this.length)
return {};
var elem = this[0];
var attrLength = elem.attributes.length;
@tehsis
tehsis / jquery.filterbydataset.js
Created March 13, 2012 04:59
jQuery plugin which filter elements acording its data in its dataset and a passed object
(function ($) {
$.fn.filterByDataset = function(compare) {
return this.filter( function() {
if ($.fn.dataset) {
var attributes = $(this).dataset();
} else {
var attributes = this.dataset;
}
var match = true;
@tehsis
tehsis / jquery.simpletabs.js
Created July 17, 2012 20:36
A simple jQuery plugin to create a tabbed navigation.
/**
* A jquery plugin to create a simple
* tabbed navigation.
* Author: Pablo Terradillos
*/
(function($) {
var that;
var _menu = 'ul'
@tehsis
tehsis / extract_tabu.pl
Created August 6, 2012 09:22
Silly script to extract tabu's word from a docx file
#!/usr/bin/env perl
use strict;
use locale;
use feature 'unicode_strings';
my @words;
my @tabues;
while(<>) {
var foo = "bar";
foo.toUpperCase(); // "BAR"
@tehsis
tehsis / gist:4434712
Created January 2, 2013 13:52
Example for tehsis.com.ar
var foo = "bar";
foo.num = 5;
console.log(foo.num); // undefined
@tehsis
tehsis / gist:4434724
Last active December 10, 2015 12:29
Example for tehsis.com.ar
var a = "foo";
var b = new String("bar");
var c = a + b;
a.a = 5;
b.a = 5;
console.log(c); // "foobar"
console.log(a.a); // undefined