Skip to content

Instantly share code, notes, and snippets.

View lucasmotta's full-sized avatar

Lucas Motta lucasmotta

View GitHub Profile
@lucasmotta
lucasmotta / Launch Chrome
Last active December 12, 2015 04:28
Launch Google Chrome without Security Warnings / Errors
open /Applications/Google\ Chrome.app/ --args --disable-web-security
@lucasmotta
lucasmotta / refresh_chrome_tab.sh
Last active July 28, 2017 10:18 — forked from mayoff/gist:1138816
Find and Refresh a given url on Google Chrome using a shell script (and AppleScript).
# Trick to execute AppleScript directly on a shell script.
# The code below will look for the given url to refresh the tab
/usr/bin/osascript << EOF
tell application "Google Chrome"
activate
set theUrl to "http://your-site-url.com"
if (count every window) = 0 then
make new window
end if
@lucasmotta
lucasmotta / post-commit.sh
Last active December 11, 2015 17:39
Post-commit deploy to server using Dandelion: https://github.com/scttnlsn/dandelion
#!/bin/sh
#
# Script to deploy to FTP after a commit using dandelion
# This hook will look for any of those tags on your commit message: #deploy, #stage, #production and #dev
# If found, it's going to deploy to the given server.
#
# The following commit message would deploy to the Production and Stage servers:
# git commit -m "Fixed bugs on the header #production #stage"
#
# But you need to have the dandelion config file with the same name of the tag.
@lucasmotta
lucasmotta / fn.imageSequence
Created October 5, 2012 09:40
Play a sequence of images on rollover, using jquery.
(function($) {
$.fn.imageSequence = function(options) {
var params = $.extend({
interval: 100,
height: parseInt(this.find("li").css("height")),
skipFirst: false
}, options);
var interval, total, id = 0;
var current = null;
@lucasmotta
lucasmotta / text-column.as
Created July 12, 2011 22:48
Column Text creation
var text : ColumnText = new ColumnText("The content goes here");
text.htmlText = "You can also change the content at any time";
text.columns = 4;
text.margin = 30;
text.width = 600;
text.height = 400;
text.apply(); // Create the columns
addChild(text);
@lucasmotta
lucasmotta / SleekTween
Created June 17, 2011 17:37
Simple tween shortcut to create sleek animations (based on TweenLite)
package fashion.nugget.motion
{
import com.greensock.TimelineLite;
import com.greensock.TweenLite;
import com.greensock.easing.Expo;
/**
* @author Grifo.tv / Danilo Figueiredo - http://www.grifo.tv
* Lucas Motta - http://lucasmotta.com
@lucasmotta
lucasmotta / gist:975920
Created May 17, 2011 03:56
Usage - Distribute children on a path of a star.
// You just have to call the static method "star" and set the parameters of your star
var instance : IDistribute = Distribute.star(items : Array, points : uint, innerRadius : Number = 50, outerRadius : Number = 100, align : String = null);
// And if you want your items rotate according to the path, do this:
var instance : IDistribute = Distribute.star(items, 5, 50, 100, null).orientToPath();
@lucasmotta
lucasmotta / star
Last active November 10, 2020 11:52
Distribute children on a path of a star
public static function star(items : Array, points : uint, innerRadius : Number = 50, outerRadius : Number = 100, align : String = null) : Distribute
{
var path : Path = new Path();
path.offset = DistributeAlign.getOffset(Math.max(innerRadius, outerRadius) * 2, Math.max(innerRadius, outerRadius) * 2, align);
var step : Number,halfStep : Number, rot : Number, px : int, py : int, i : int;
step = (Math.PI * 2) / points;
halfStep = step / 2;
rot = Math.PI / (points % 4 ? 2 : 4);
px = Math.round(Math.cos(- rot) * outerRadius);
@lucasmotta
lucasmotta / gist:975761
Created May 17, 2011 02:09
Returns a specific point from segments of points
public function getPointAt(progress : Number) : Point
{
var i : int;
var length : int = _points.length;
var pointProgress : Number;
var totalProgress : Number = 0;
for(i = 1 ; i < length; i++)
{
pointProgress = Point.distance(_points[i], _points[i - 1]) / _length;