Skip to content

Instantly share code, notes, and snippets.

View langri-sha's full-sized avatar
😪
Three, one, four, one, z, z, z...

Filip Dupanović langri-sha

😪
Three, one, four, one, z, z, z...
View GitHub Profile
#!/usr/bin/env python
# attach-android-source.py - script to attach android source to a SDK folder using symlinks
# See http://mobilepearls.com/labs/viewing-android-source-code-in-eclipse/
#
# Use as:
# python attach-android-src.py $PATH_TO_SRC $PATH_TO_SDK_PLATFORM
# where $PATH_TO_SRC is the path to an android source checkout (the folder you run "repo init" in if
# you follow the instructions on http://source.android.com/source/download.html) and
# $PATH_TO_SDK_PLATFORM is to a platform folder inside the android sdk folder
@remy
remy / trim-canvas.js
Last active May 3, 2024 13:39
Trims the surrounding transparent pixels from a canvas
// MIT http://rem.mit-license.org
function trim(c) {
var ctx = c.getContext('2d'),
copy = document.createElement('canvas').getContext('2d'),
pixels = ctx.getImageData(0, 0, c.width, c.height),
l = pixels.data.length,
i,
bound = {
top: null,
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@tychobrailleur
tychobrailleur / .jrubyrc
Created March 4, 2012 14:32
Sample .jrubyrc, with comments
# Example of .jrubyrc
# Set compilation mode. JIT = at runtime; FORCE = before execution. (JIT, FORCE, OFF, OFFIR)
# compile.mode = FORCE
# Dump to console all bytecode generated at runtime.
# compile.dump = true
# Enable verbose JIT logging (reports failed compilation)
# jit.logging.verbose = true
@manpages
manpages / the-case-for-gist-blogging.org
Created April 28, 2012 06:16
Why do I love to use gist as a blog engine?

The case for Gist blogging

Why to bother?

The posts people write in blogs can be classified in two groups:

  • those that are going to be (or should be) maintained, expressing the real time information (like books one reads or read, todo lists, lecture notes, etc),
  • those that express the momentary thoughts of a writer on an event or activity.

Maintaining the post

While first ones can be managed using standart blog engines (livejournal, blogger, etc) via «Edit post» option, that’s hardly

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cobyism
cobyism / gh-pages-deploy.md
Last active May 7, 2024 18:46
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).

@addyosmani
addyosmani / headless.md
Last active May 7, 2024 12:36
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@andru255
andru255 / gist:7295850
Last active December 1, 2021 00:39
Install phantomJS and SlimerJS into linux debian 64 bits
PhantomJS (has the engine webkit)
download from the page http://phantomjs.org/download.html
and then in terminal
$ cd /usr/local/share/
$ sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
$ sudo tar jxvf phantomjs-1.9.8-linux-x86_64.tar.bz2
$ sudo ln -s /usr/local/share/phantomjs-1.9.8-linux-x86_64/ /usr/local/share/phantomjs
$ sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs