Skip to content

Instantly share code, notes, and snippets.

View lucasmotta's full-sized avatar

Lucas Motta lucasmotta

View GitHub Profile
@jimmyhillis
jimmyhillis / keybindings.md
Last active April 17, 2024 08:39
iTerm 2 Mac-ready key binding additions.

Standard bindings

  • Move left between words: ⌥← | send escape sequence | b
  • Move right between words: ⌥→ | send escapes sequence | f
  • Start of the line: ⌘← | send escape sequence | [H
  • End of the line ⌘→ | send escape sequence | [F
  • Delete previous word ⌥←Delete | send hex code | 0x1B 0x08
  • Delete entire line ⌘←Delete | send hex code | 0x15

Don't forget the amazing icons ⌘ = command and ⌥ = options/alt (why oh why?).

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@millermedeiros
millermedeiros / osx_setup.md
Last active May 1, 2024 20:46
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

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).

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@millermedeiros
millermedeiros / updateLibs.sh
Last active October 11, 2015 12:37
Shell script to update 3rd party libs
#!/bin/sh
# This shell script is used to bootstrap the app and update external libraries
#
# ====== IMPORTANT ======
#
# it may break application if 3rd party libs aren't backwards compatible
# or if libs were edited locally, use with care !!!
@burin
burin / gist:3840737
Created October 5, 2012 16:06
Full screen web app in iPhone 5 (save to home screen)
<!-- standard viewport tag to set the viewport to the device's width
, Android 2.3 devices need this so 100% width works properly and
doesn't allow children to blow up the viewport width-->
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" />
<!-- width=device-width causes the iPhone 5 to letterbox the app, so
we want to exclude it for iPhone 5 to allow full screen apps -->
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)" />
<!-- provide the splash screens for iPhone 5 and previous -->
<link href="assets/splashs/splash_1096.png" rel="apple-touch-startup-image" media="(device-height: 568px)">
<link href="assets/splashs/splash_iphone_2x.png" rel="apple-touch-startup-image" sizes="640x960" media="(device-height: 480px)">
@lpdumas
lpdumas / panTo.js
Created September 13, 2012 15:28
Simple pan method for Google map API v3 to pan the map with a certain offset. In this case, used within a custom infoWindow class.
CustomInfoWindow.prototype.panMap = function(marker, map) {
var offsetX = 100
var offsetY = 75
var scale = Math.pow(2,map.getZoom())
var center = map.getProjection().fromLatLngToPoint(marker.getPosition())
var newCenterPoint = new google.maps.Point(
center.x - offsetX/scale,
center.y + offsetY/scale
)
@Grawl
Grawl / prefix-free.styl
Created February 4, 2012 08:29 — forked from sapegin/gist:1735915
-prefix-free for Stylus
// #### it's compilable -prefix-free
// © 2011 Artem Sapegin http://sapegin.ru
// + 2011 Grawl http://grawl.ru
// + radial-gradient and other rules with vendor prefixes added by Grawl.
// add your fixes to My table of vendor prefixes there: http://goo.gl/3hPfR
/* mask:
parameter()
-webkit-parameter arguments
-moz-parameter arguments
-ms-parameter arguments
@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php