Skip to content

Instantly share code, notes, and snippets.

@banksean
banksean / perlin-noise-classical.js
Created February 15, 2010 10:00
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@kanemu
kanemu / IndInteractiveConsole.jsx
Created January 19, 2011 12:33
[indesign]InDesign Interactive Console
/*
* InDesign Interactive Console
* @nbqx made the original of this script.
* http://d.hatena.ne.jp/nbqx69/20100617#p1
*/
#target Indesign
#targetengine nbqx
//ユーティリティ
@indragiek
indragiek / ColorOverlay.m
Created May 3, 2011 03:30
Replicating Photoshop Layer Styles Using Core Graphics
CGContextRef ctx = UIGraphicsGetCurrentContext(); // your drawing context
CGRect colorRect = CGRectMake(0, 0, 100, 100); // the rect to draw the color overlay into
// Set the blend mode to "Normal"
// This is the default blend mode setting so this line is not required, shown here for demonstration
CGContextSetBlendMode(ctx, kCGBlendModeNormal);
// Set the opacity of the drawing context (once again, not required)
CGContextSetAlpha(ctx, 1.0);
// Create the red color
CGColorRef redColor = CGColorCreateGenericRGB(0.908, 0.149, 0.145, 1.000);
// Set the fill color of the context and fill the rect
@gre
gre / easing.js
Last active May 17, 2024 03:33
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@gre
gre / EasingFunctions.json
Last active January 11, 2023 10:28
DEPRECATED Please use http://github.com/gre/bezier-easing for latest vrrsion.
{
"ease": [0.25, 0.1, 0.25, 1.0],
"linear": [0.00, 0.0, 1.00, 1.0],
"ease-in": [0.42, 0.0, 1.00, 1.0],
"ease-out": [0.00, 0.0, 0.58, 1.0],
"ease-in-out": [0.42, 0.0, 0.58, 1.0]
}
@jcaraballo
jcaraballo / git-branch-between-different-repositories.md
Created March 6, 2012 01:05
How to fork a github repository in bitbucket

#Create bitbucket branch

##Create local branch

$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
  master
* sync
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
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:

@pietrop
pietrop / issuu_downloader.rb
Created June 29, 2014 18:04
To download magazine from issuu.com when the download option has been disabled. in practice the script doesn't actually download the pdf, but rather download the images of the pages of the flash object and then combines those into a pdf
require 'mechanize'
require 'prawn'
=begin
running from terminal to download any pdf from issuu.com, given
- magazine name
- page count
- document-id
=end