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 / campus.coffee
Created January 8, 2014 13:31
Campus Page Code
jQuery ->
######################################
# BACKBONE CODE
######################################
# INITIALIZES Campus OBJ SO WE CAN CREATE ALL THE COMPONENTS ON IT
Campus = {}
######################################
# CODE FOR THE SIDEBAR AND MAP
######################################
@gustavoguichard
gustavoguichard / seeds.rb
Created December 3, 2013 23:58
Seed example
# utf-8
# Migrate data from old database
old_database = File.read(Rails.root.join('db/old_database.sql'))
ActiveRecord::Base.connection.execute old_database
convert_old_data = File.read(Rails.root.join('db/convert_old_data.sql'))
ActiveRecord::Base.connection.execute convert_old_data
# Create first access tokens
User.all.each do |u|
u.first_access_token = u.id.to_s + Devise.friendly_token
@gustavoguichard
gustavoguichard / template-campus.php
Created November 22, 2013 21:01
Campus Page Old Gallery HTML
<section class="gallery-section" id="cathedral-gallery">
<nav class="gallery-arrows">
<a href="#" class="gallery-arrow arrow-prev">&lt;</a>
<a href="#" class="gallery-arrow arrow-next">&gt;</a>
</nav>
<img src="<?php echo get_template_directory_uri();?>/img/campus/cathedral_gallery_image_1.jpg" class="gallery-img" />
<img src="<?php echo get_template_directory_uri();?>/img/campus/cathedral_gallery_image_2.jpg" class="gallery-img" />
<img src="<?php echo get_template_directory_uri();?>/img/campus/cathedral_gallery_image_3.jpg" class="gallery-img" />
<img src="<?php echo get_template_directory_uri();?>/img/campus/cathedral_gallery_image_4.jpg" class="gallery-img" />
</section>
@gustavoguichard
gustavoguichard / _campus.sass
Created November 22, 2013 21:00
Campus Page Gallery CSS
.gallery-section
position: relative
z-index: 20
height: 50%
padding-top: 62.5%
.gallery-img
width: 100%
top: 0
position: absolute
+transition(.5s)
@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
@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 / 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
[[ -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"'
.button
box-shadow: 0 0 0 7px $clouds
margin: 7px
text-transform: uppercase
font-size: .9em
#logo
+image-replace('logo.png')
margin-top: 40px
{
"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",