Skip to content

Instantly share code, notes, and snippets.

View lucasmotta's full-sized avatar

Lucas Motta lucasmotta

View GitHub Profile

Setup Mac OS X Mountain Lion or Mavericks

Setup

1. Run software update

Make sure everything is up to date.

/**
The following script works like this:
1. Auto play the game
2. Get all the color elements (<span>) inside the game
3. Push the elements to different arrays based on it's color
i.e:
– If it's a "red" color, goes to the "red" array
– If it's a "blue" color, goes to the "blue" array
4. Check each of those arrays has only one element, which is the one that
has a different/unique color compared to the others
@lucasmotta
lucasmotta / dir_777_to_755.sh
Created November 7, 2014 11:10
Change all 777 directories only to 755
find . -type d -perm 777 -exec chmod 755 {} \;

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@lucasmotta
lucasmotta / SassMeister-input-HTML.html
Created April 29, 2015 09:26
Generated by SassMeister.com.
<div class="box-grey"></div>
<div class="box-rounded"></div>
@lucasmotta
lucasmotta / delete-empty-folders.sh
Created June 15, 2015 08:42
Delete all empty folders recursively
find . -type d -empty -delete
@lucasmotta
lucasmotta / is-port-being-used
Created July 20, 2015 11:15
Check if a specific port is being used on Mac OX
sudo lsof -i :8000 # checks port 8000
@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;
@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 / 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