Skip to content

Instantly share code, notes, and snippets.

View lucasmotta's full-sized avatar

Lucas Motta lucasmotta

View GitHub Profile
@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>

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 / 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 {} \;
/**
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 / parseMustache.coffee
Last active August 10, 2018 07:52
A simple function to parse strings with {{mustache}} tags and replace its dot notation string to a given object path.
parseMustache = (str, obj) ->
str.replace /{{\s*([\w\.]+)\s*}}/g, (tag, match) ->
nodes = match.split(".")
current = obj
for node in nodes
try
current = current[node]
catch
return ""
current

Setup Mac OS X Mountain Lion or Mavericks

Setup

1. Run software update

Make sure everything is up to date.

@lucasmotta
lucasmotta / nodejitsy-error
Created October 15, 2013 16:53
Gist error
info: Creating snapshot 0.0.1-1
info Uploading: [=============================] 100%
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>
help: irc: <irc://chat.freenode.net/#nodejitsu>
help: email: <support@nodejitsu.com>
help:
help: Copy and paste this output to a gist (http://gist.github.com/)
@lucasmotta
lucasmotta / gist:5222116
Last active December 15, 2015 07:19
Install the post-commit script on your .git repository. Don't forget that you need to be in the root folder of where your .git repository is.
curl -o .git/hooks/post-commit https://gist.github.com/lucasmotta/4636472/raw/29efcf2a4bf2bec7901b022b7d1f9c0300cd0279/post-commit.sh && sudo chmod 755 .git/hooks/post-commit
@lucasmotta
lucasmotta / optimise_images.sh
Created February 14, 2013 11:26
Optimize and convert to JPG Progressive all the .jpg files of the current folder using jpegtran.
find . -name "*.jpg" -print0 | xargs -0 -I filename jpegtran -copy none -optimise -progressive -outfile filename filename
@lucasmotta
lucasmotta / remove_blink.css
Created February 14, 2013 10:12
Remove the blink/flash on iOS when a link is clicked