Skip to content

Instantly share code, notes, and snippets.

View gustavoguichard's full-sized avatar
🏠
Working from home

Guga Guichard gustavoguichard

🏠
Working from home
View GitHub Profile
@gustavoguichard
gustavoguichard / gist:4073942
Created November 14, 2012 18:44
Semantic-mixins use case
#site_overview
background-color: $aqua
padding: 2*$base-margin 0
+decorative-content
$name: "star"
+sprite-replace($name)
+absolute-centering(sprites-sprite-width($name))
bottom: - sprites-sprite-height($name)/2
.post_overview
@gustavoguichard
gustavoguichard / gist:4073966
Created November 14, 2012 18:50
Semantic-mixin use case compiled
#site_overview {
background-color: #e5edf3;
padding: 2.8em 0;
position: relative;
}
#site_overview:after {
background: url('../images/sprites-s2d93560836.png') no-repeat;
content: "";
display: block;
@gustavoguichard
gustavoguichard / gist:4161527
Created November 28, 2012 14:05
Analytics in wordpress
/* GOOGLE ANALYTICS */
function add_google_analytics() {
echo '<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>';
echo '<script type="text/javascript">';
echo 'var pageTracker = _gat._getTracker("CODIGO_AQUI");';
echo 'pageTracker._trackPageview();';
echo '</script>';
}
add_action('wp_footer', 'add_google_analytics');
@gustavoguichard
gustavoguichard / gist:4217696
Created December 5, 2012 17:28
Get permalink by name
function get_permalink_by_name($page_name)
{
global $post;
global $wpdb;
$pageid_name = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
return get_permalink($pageid_name);
}
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
# export PS1="\[\e[0;31m\][\u] \W\n$ "
export PS1='\[\e[1;37m\]\W\[\e[1;36m\]$(parse_git_branch)\[\e[0;39m\]\n$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
{
"auto_complete": true,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment",
"auto_complete_size_limit": 4194304,
"auto_complete_with_fields": true,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
.button
box-shadow: 0 0 0 7px $clouds
margin: 7px
text-transform: uppercase
font-size: .9em
#logo
+image-replace('logo.png')
margin-top: 40px
@gustavoguichard
gustavoguichard / city.rb
Last active December 17, 2015 02:09
Check if image is in directory
def image_url
File.exists?("#{Rails.root}/app/assets/images/cities/#{slug}.jpg") ? "cities/#{slug}.jpg" : "cities/rio-de-janeiro.jpg"
end
@gustavoguichard
gustavoguichard / .bash_profile
Last active December 19, 2015 19:09
MyBash
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
# export PS1="\[\e[0;31m\][\u] \W\n$ "
export PS1='\[\e[1;37m\]\W\[\e[1;36m\]$(parse_git_branch)\[\e[0;39m\]\n${debian_chroot:+($debian_chroot)}\[\033[00;36m\]⚡ '
@gustavoguichard
gustavoguichard / campus.coffee
Created November 22, 2013 20:56
Campus Page Old JS
jQuery ->
######################################
# PLUGINS
######################################
# VERIFIES IF OBJECT IS ON BROWSERS VIEWPORT
jQuery.fn.isOnScreen = (offsetTop = 0, offsetLeft = 0)->
win = $(window)
viewport = {
top: win.scrollTop() + offsetTop
left: win.scrollLeft() + offsetLeft