Skip to content

Instantly share code, notes, and snippets.

View alexandrebini's full-sized avatar

Alexandre Bini alexandrebini

View GitHub Profile
@alexandrebini
alexandrebini / gist:2837074
Created May 30, 2012 15:41
m.clickjogos.uol.com.br
# m.clickjogos
if ($http_user_agent ~ (^Fly|^htc|^HTC|^Huawei|^HUAWEI|^INQ|^LENOVO|^LG|^MAUI|^mot-|^MOT|^nokia|^NOKIA|^NEC|^Openwave|
^OPENWAVE|^samsung|^SEC|^sgh|^SPH-|^SIE|^Xda|^ZTE|ACS-NF|Amoi|Android|Alcatel|BenQ|BENQ|BlackBerry|
Cellphone|DoCoMo|ericsson|Ericsson|HTC|Hutchison|imode|iPAQ|iPhone|LGE|Maemo|Maui\ Browser|MAUI\ WAP|
MIDP|Mitsu|Mobi|mobile|Mobile|Motorola|NetFront|Netfront|Nintendo\ DSi|nokia|Nokia|Obigo|Palm|
Panasonic|PHILIPS|Phone|PlayStation\ Portable|portalmmm|SAGEM|SAMSUNG|Samsung|SANYO|Sanyo|SCH\-|Sendo|
SHARP|Smartphone|SmartPhone|Symbian\ OS|SymbianOS|Teleca|Toshiba|UP\.Browser|Vodafone|webOS|wap|WAP|Windows\ CE) ) {
rewrite ^(.*) http://m.clickjogos.uol.com.br/ permanent;
}
RewriteCond %{HTTP_USER_AGENT} ^Fly [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^htc [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^HTC [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Huawei [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^HUAWEI [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^INQ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^LENOVO [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^LG [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^MAUI [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^mot- [NC,OR]
yaml = YAML.load_file("#{Rails.root}/config/shopping.yml")
yaml.each do |tab, products|
products.each do |a, values|
tab_name = tab.gsub ' ', '_'
name = values.first.gsub ' ', ''
link = values.last
puts "#{tab_name}: #{name}"
puts "http://clicklogger.rm.uol.com.br/shopping/?prd=239&grp=skin:clickjogos;src:14;size:19;chn:102;pos:4;thm:#{tab_name};creative:#{name}&msr=Cliques%20de%20Origem:1&oper=11&redir=#{ link }"
puts
% Facts
parent(dirce, gislene).
parent(dirce, irair).
parent(valdemar, gislene).
parent(valdemar, irair).
parent(gislene, alexandre).
parent(gislene, fakebrother).
parent(irair, fernando).
% Rules
{
"auto_complete": false,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
!!! 5
%html
%head
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }
App.Router.reopen
location: 'history'
enableLogging: true
App.Router.map ->
@resource 'admin', ->
@resource 'wallpapers', ->
@route 'new'
App.AdminRoute = Ember.Route.extend
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
export PS1='\[\e[1;37m\]\w\[\e[m\] $(parse_git_branch "(%s)" ) \[\e[1;32m\]\$ \[\e[m\]\[\e[1;37m\]'
export EDITOR=nano
#For jpeg files
#Need to install jpegtran in ubuntu
sudo apt-get install libjpeg-progs
Usage tips:
#To optimise a single jpeg image:
jpegtran -copy none -optimise -outfile image.jpg image.jpg
#To optimise all jpegs in the current directory:
for img in `ls *.jpg`; do jpegtran -copy none -optimise -outfile $img $img; done
@alexandrebini
alexandrebini / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console