Skip to content

Instantly share code, notes, and snippets.

View americos's full-sized avatar
💭
Coding, coding, and coding some more

Americo Savinon americos

💭
Coding, coding, and coding some more
  • Malaga, Spain
  • 19:19 (UTC +02:00)
  • X @americos
View GitHub Profile
[alias]
co = checkout
a = add
s = show
st = status
d = diff
ds = diff --staged
ci = commit
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
##Based on: https://gist.github.com/871284e41058014863e0
MAGENTA="\033[1;31m"
ORANGE="\033[1;33m"
GREEN="\033[1;32m"
PURPLE="\033[1;35m"
WHITE="\033[1;37m"
BOLD=""
RESET="\033[m"
parse_git_dirty () {
@americos
americos / retina@2x_2x
Created April 28, 2014 18:50
Renaming retina images filenames from: @2x to _2x
for filename in *@2x*; do mv "$filename" "${filename//@2x/_2x}"; done
@americos
americos / LocationCalendarDayHours.rb
Last active August 29, 2015 13:57
Stack level too deep?
# Why I get stack level too deep in IRB, when calling:
# location = VendorLocation.find 53575
# LocationCalendarDayHours.from_java_json(location.calendarHours).first.weekday_type_code
#
# Note: I created weekday_type.rb as a WwConstant
class LocationCalendarDayHours
include ActiveModel::Model
include WWLegacyJavaJsonSupport
@americos
americos / gist:8056510
Created December 20, 2013 15:40
My gitconfig
[user]
name = Americo Savinon
email = americos@gmail.com
[color]
diff = auto
status = auto
branch = auto
[alias]
visual = gitk
[core]
@americos
americos / gist:6106137
Created July 29, 2013 17:47
Creating playlists for JW5
#Return a json string of related videos for JW Player playlist
def get_related_videos_for_jwplayer
related = self.related_clips
result = []
#Self Clip
result << {
"file" => self.rate_limited_url,
"image" => self["thumb_url"],
"title" => self["title"]
@americos
americos / newest_home_garden.sql
Created July 24, 2013 19:48
video_clip.paginate_newest_by_category MS Query for Home and Garden
SELECT distinct(video_clips.id), video_clips.filename, video_clips.title,
video_clips.video_id, video_clips.thumb_file_name, video_clips.stands_alone,
video_clips.is_thumbset_hosted, video_clips.headline, categories_videos.video_id,
categories_videos.category_id, videos.is_live, videos.is_ugc, videos.is_private,
videos.live_date FROM `video_clips` INNER JOIN `videos` ON `videos`.`id` = `video_clips`.`video_id` INNER JOIN `categories_videos` ON `categories_videos`.`video_id` = `videos`.`id` INNER JOIN `categories` ON `categories`.`id` = `categories_videos`.`category_id` WHERE (videos.is_live = 1 AND
videos.is_ugc = 0 AND
videos.is_private = 0 AND
(videos.is_deleted IS NULL OR videos.is_deleted = 0) AND
categories_videos.category_id IN (111,112,113,114,115,116,117,118,119,120,121,122,123,124,125)) ORDER BY video_clips.stands_alone DESC, videos.live_date DESC LIMIT 15 OFFSET 0
@americos
americos / flashVars.js
Created July 10, 2013 20:37
flashVars Object for Adap.tv
var flashVars = {
key: "MonkeySee",
id: "k_msilton_kraft_snack_9-12-11_008_012",
title: "Cheese Snacks - Ice Cream Cone",
addConn: "FOODANDDRINK",
categories: "Low-Carb,Food &amp; Drink",
companionId: "ad300x250",
context:{
title: "Cheese Snacks - Ice Cream Cone"
},
<%= form_for @video, :url => {:action => (@video.new_record? ? 'name_video' : 'update'),
:id => (@video.new_record? ? nil : @video)} do |f| %>
<div id='columnForm'>
<fieldset>
<legend>
Video Information
</legend>
<label for="source_code">Video Source:
<%= f.collection_select('video_source_id',
require 'youtube_it'
USER = "YOUTUBE_USER_NAME"
PASS = "YOUTUBE_PASS"
DEV_KEY = "YOUTUBE_DEV_KEY"
##Upload a video
uploader = YouTubeIt::Upload::VideoUpload.new(
:username => USER,
:password => PASS,