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
//trim completo | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g,""); | |
} | |
//left trim | |
String.prototype.ltrim = function () { | |
return this.replace(/^\s+/,""); | |
} |
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
Array.prototype.inArray = function (value) | |
{ | |
var i; | |
for (i=0; i < this.length; i++) | |
{ | |
if (this[i] == value) | |
{ | |
return 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 str_pad (input, pad_length, pad_string, pad_type) { | |
// * example 1: str_pad('', 30, '-=', 'STR_PAD_LEFT'); | |
// * returns 1: '-=-=-=-=-=-foo bar milk' | |
// * example 2: str_pad('foo bar milk', 30, '-', 'STR_PAD_BOTH'); | |
// * returns 2: '------foo bar milk-----' | |
var half = '', | |
pad_to_go; |
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
@font-face { | |
font-family: 'font_desejada'; | |
src: url('font_desejada.eot'); | |
src: url('font_desejada?#iefix') format('embedded-opentype'), | |
url('font_desejada.woff') format('woff'), | |
url('font_desejada.ttf') format('truetype'), | |
url('font_desejada.svg#font_desejada') format('svg'); | |
font-weight: normal; | |
font-style: normal; |
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
window.onload = function () { | |
var element = document.body; | |
var attr = document.createAttribute('class'); | |
attr.nodeValue = 'ie7'; | |
element.setAttributeNode(attr); | |
}; |
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
.text-hide | |
{ | |
text-indent: 100em; | |
text-transform: capitalize; | |
overflow: hidden; | |
white-space: nowrap; | |
display: block; | |
} |
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
#!/usr/bin/env ruby | |
# Remove all gems EXCEPT defaults :) | |
`gem list -d`.split(/\n\n^(?=\w)/).each do |data| | |
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/) | |
name = match[:name] | |
versions = match[:versions].split(', ') | |
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/) | |
next if match[1].empty? # it's the only version if this match is empty |
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 class GsonRequest<T> extends Request<T> { | |
private Gson gson = new Gson(); | |
private Class<T> model; | |
private Map<String, String> params; | |
private Map<String, String> headers; | |
private Listener listener; | |
public GsonRequest(int method, String url, Class<T> model, Map<String, String> params, Map<String, String> headers, |
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTPS} off | |
# First rewrite to HTTPS: | |
# Don't put www. here. If it is already there it will be included, if not | |
# the subsequent rule will catch it. | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Now, rewrite any request to the wrong domain to use www. | |
RewriteCond %{HTTP_HOST} !^www\. |
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
<?php | |
function serverUrl($requestUri = null) { | |
switch (true) { | |
case (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] === true)): | |
case (isset($_SERVER['HTTP_SCHEME']) && ($_SERVER['HTTP_SCHEME'] == 'https')): | |
$scheme = 'https'; | |
break; | |
default: | |
$scheme = 'http'; |
OlderNewer