This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function() { | |
var src, scriptTag; | |
src = "./app.js"; // here goes the name of the file to include | |
scriptTag = document.createElement('SCRIPT'); | |
scriptTag.src = src; | |
document.body.appendChild(scriptTag); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// loveWins(): a simple function that accepts a UIImage and | |
// returns the same image blended with the rainbow flag | |
// of the LGBT pride movement. | |
// | |
// This is released for pedagogical reasons (I've tried to make | |
// the code as easy to follow as possible!) but you're welcome | |
// to use it for any purpose – consider the code yours. | |
// | |
// If you're using Xcode 7 / Swift 2, you need to make a tiny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function table($array,$headers = '',$title = ''){ | |
$table = ''; | |
$table .= "<table id=table class=table >\n"; | |
if($title != ''){ | |
$table .= "<caption >$title</caption>\n"; | |
} | |
$table .=" <thead><tr>\n"; | |
$r = 1; | |
if(!is_array($headers)){ | |
$headers = array_keys($array[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//receives a query and returns an array in the following format | |
// array['row-number']['field_name'] = 'value' | |
function q2ar($query){ | |
$query = $this->mysql($query); | |
$n=0; | |
$data = ''; | |
if(is_resource($query)){ | |
while($row = mysql_fetch_row($query) ){ | |
$i=0; | |
while ($i < mysql_num_fields($query)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
ini_set('max_execution_time',0); | |
//tells you how much it would take to add several lines in your db, change ur password and all that off //course.. | |
//_GET[i] is the ammount of lines | |
$time_start = microtime(true); | |
$sql = mysql_connect('localhost','root','magic'); | |
mysql_select_db('test',$sql); | |
mysql_set_charset('utf8'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('form').submit(function(event) { | |
event.preventDefault(); | |
var formData = $(this).serialize(); | |
$.ajax({ | |
type : 'POST', | |
url : $(this).attr('action'), | |
data : formData, | |
dataType : 'json', | |
encode : true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! CHANGE_CURR_DIR() | |
let _dir = expand("%:p:h") | |
exec "cd " . _dir | |
unlet _dir | |
endfunction | |
autocmd BufEnter * call CHANGE_CURR_DIR() | |
set statusline=%<%f%h%m%r%=%{&ff}\ %l,%c%V\ %P | |
set history=99999 | |
set nonu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"tommorrow-night - Full Colour and 256 Colour | |
" http://chriskempson.com | |
" | |
" Hex colour conversion functions borrowed from the theme "Desert256"" | |
" Default GUI Colours | |
let s:foreground = "c5c8c6" | |
let s:background = "000000" | |
let s:selection = "373b41" | |
let s:line = "282a2e" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Colocar clase date-input | |
$(function(){ | |
$('.date-input').attr('placeholder','AAAA-MM-DD').on('change', function(e){ | |
var dt=$(this).val(); | |
if(dt!='') | |
{ | |
var da= dt.split('-'); | |
var l = da.length; | |
if(l <= 3) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var makeCounter = function(){ | |
var n=0; | |
return function(){ | |
return n = n + 1; | |
} | |
} | |
var counter1 = makeCounter(); | |
var counter2 = makeCounter(); |