Skip to content

Instantly share code, notes, and snippets.

View dirceu's full-sized avatar

Dirceu Pereira Tiegs dirceu

View GitHub Profile
Dir['*.md'].each do |filename|
content = File.open(filename).read
#if ["-", ""].include?(content.strip)
# File.delete(filename)
# next
#end
File.open(filename, 'w') do |f|
f.write("# #{filename.gsub('.md', '')}\n\n")
f.write(content)
@dirceu
dirceu / keybase.md
Created January 10, 2017 23:27
keybase.md

Keybase proof

I hereby claim:

  • I am dirceu on github.
  • I am dirceu (https://keybase.io/dirceu) on keybase.
  • I have a public key whose fingerprint is E0BB CF55 AD7D 7E76 2C26 73EF F04F A468 0D19 D93D

To claim this, I am signing this object:

@dirceu
dirceu / foobar.php
Created September 8, 2015 19:43
Array of ranges and single values
<?php
$color1 = array_merge(
range(1, 5),
array(9),
range(13, 25),
array(26, 29, 30)
);
@dirceu
dirceu / keybase.md
Created February 25, 2015 02:14
keybase.md

Keybase proof

I hereby claim:

  • I am dirceu on github.
  • I am dirceu (https://keybase.io/dirceu) on keybase.
  • I have a public key whose fingerprint is A579 3DB2 9503 B761 4E56 230C 6556 5D74 27B9 EF6E

To claim this, I am signing this object:

@dirceu
dirceu / displayselectors.jquery.js
Created May 18, 2012 13:16
jQuery selectors for elements with display 'block' and 'inline'
(function($) {
$.extend($.expr[':'], {
inline: function(a) {
return $(a).css('display') == 'inline';
},
block: function(a) {
return $(a).css('display') == 'block';
}
});
})(jQuery);
@dirceu
dirceu / instagram.php
Created September 5, 2011 22:57
Instagram JPlatform example
<?php
define('_JEXEC', 1);
//
// Author: Dirceu Pereira Tiegs <dirceu@jetworks.com.br> and other folks from #jdbr11
// Jetworks Desenvolvimento Web
//
// run this inside joomla-platform/examples/
require_once ('../libraries/import.php');
jimport('joomla.application.cli');
require 'spec_helper'
cancel_paperclip_post_processing YourClass
describe YourClass do
describe "validations" do
it "should require a valid contract file (if supplied)" do
YourClass.should have_attached_file(:contract)
// Imported from http://www.nationsonline.org/oneworld/IATA_Codes/airport_code_list.htm
// Use the "jQuerify" extension for Google Chrome and run the following script on the JavaScript Console
var airports = [];
$.each($('tr[bgcolor=#EEEEEE]'), function(idx, el) {
airports.push('INSERT INTO `ean_airports` (`city`, `country`) VALUES ("'+$('td', el)[0].textContent.trim()+' ('+$('td', el)[2].textContent.trim()+')", "'+$('td', el)[1].textContent.trim()+'");');
});
airports.sort();
airports.join('\n');
<?php
/**
* Archive jobs after the end date
*
* @return void
* @access private
* @since 2.0
*/
private function _archiveJobs()
{
jQuery.noConflict(); // necessario para nao conflitar com o MooTools
// jQuery(document).ready faz com que a funcao callback seja executada
// assim que o DOM estiver pronto. Eh melhor que onload porque nao precisa
// esperar por imagens e outros assets demorados pra carregar.
jQuery(document).ready(function() {
var maxWidth = 905; // max width da barra de rolagem
var container = jQuery('#block-wrap'), // div com overflow:hidden
handler = jQuery('#tl-nav-current-bk'), // botao de rolagem
maxHandlerPos = maxWidth-55, // posicao maxima do botao