Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Dirceu Pereira Tiegs dirceu

🚀
View GitHub Profile
View roam-bkp-to-bear.rb
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)
View 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 Sep 8, 2015
Array of ranges and single values
View foobar.php
<?php
$color1 = array_merge(
range(1, 5),
array(9),
range(13, 25),
array(26, 29, 30)
);
View 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
jQuery selectors for elements with display 'block' and 'inline'
View displayselectors.jquery.js
(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 Sep 5, 2011
Instagram JPlatform example
View instagram.php
<?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');
View yourclass_spec.rb
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)
View import_airport_codes.js
// 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');
View gist:527337
<?php
/**
* Archive jobs after the end date
*
* @return void
* @access private
* @since 2.0
*/
private function _archiveJobs()
{
View timeline.js
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