This file contains hidden or 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
| require "addressable/uri" | |
| class Hash | |
| def to_url_params | |
| uri = Addressable::URI.new | |
| keys.size.times do |i| | |
| self[keys[i]] = "#{values[i].to_s}" | |
| end |
This file contains hidden or 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
| #idéia inicial | |
| class TrendTopics | |
| attr_accessor :texto | |
| def meu_trend_topic | |
| words = texto.downcase.gsub(/[^a-z\s]/, "").split | |
| hash_words = Hash.new(0) | |
| words.each do |word| |
This file contains hidden or 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 removeAcentos($str) { | |
| $enc = (mb_detect_encoding($str, 'UTF-8', true)) ? 'UTF-8' : 'ISO-8859-1'; | |
| $acentos = array('A' => '/À|Á|Â|Ã|Ä|Å/', | |
| 'a' => '/à|á|â|ã|ä|å/', |
This file contains hidden or 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 inspect(obj, maxLevels, level) | |
| { | |
| var str = '', type, msg; | |
| // Start Input Validations | |
| // Don't touch, we start iterating at level zero | |
| if(level == null) level = 0; | |
| // At least you want to show the first level | |
| if(maxLevels == null) maxLevels = 1; |
This file contains hidden or 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() { | |
| $.fn.serialize = function (options) { | |
| return $.param(this.serializeArray(options)); | |
| }; | |
| $.fn.serializeArray = function (options) { | |
| var o = $.extend({ | |
| checkboxesAsBools: false | |
| }, options || {}); |
This file contains hidden or 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 get_remote_file(filename, url, fn_end, fn_progress ) { | |
| Ti.API.info("[filename]" + filename); | |
| Ti.API.info("[url]" + url); | |
| var file_obj = {file:filename, url:url, path: null}; | |
| var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename); | |
| if ( !file.exists() ) { |
This file contains hidden or 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 | |
| /* | |
| * Tive um sonho muito estranho essa noite, | |
| * sonhei que estava escrevendo php desta forma abaixo | |
| * no meu sonho parecia algo meio ruby + php + python | |
| * | |
| * sei lá acho que estou com pânico de "{" | |
| */ |
This file contains hidden or 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 | |
| # ATENÇÃO - PARTE DESTE CÓDIGO NÃO FUNCIONA! | |
| # Hoje em dia temos | |
| if($cor == "Vermelho") | |
| echo "Faça algo"; | |
| endif; | |
| # e também | |
| switch($cor) |
This file contains hidden or 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 win = Titanium.UI.currentWindow; | |
| var ind=Titanium.UI.createProgressBar({ | |
| width:200, | |
| height:50, | |
| min:0, | |
| max:1, | |
| value:0, | |
| style:Titanium.UI.iPhone.ProgressBarStyle.PLAIN, | |
| top:10, |
OlderNewer