Skip to content

Instantly share code, notes, and snippets.

View meherhowji's full-sized avatar
👋
Hello Friend!

Meher Ranjan Howji meherhowji

👋
Hello Friend!
View GitHub Profile
@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.
*/
attr_accessor :attachment64
before_validation :save_attachment64
has_attached_file :attachment, :storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/aws.yml",
:path => "messages_images/:id/:style/:filename",
:styles => { :original => ['1000x600>'],
:normal => ['500x500>'],
:stack => ['137x133>']
},
@gre
gre / easing.js
Last active June 27, 2024 15:37
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 = {
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@binarymax
binarymax / canvasfloodfill.js
Created November 14, 2012 12:36
Javascript Canvas FloodFill functions
//MIT License
//Author: Max Irwin, 2011
//Floodfill functions
function floodfill(x,y,fillcolor,ctx,width,height,tolerance) {
var img = ctx.getImageData(0,0,width,height);
var data = img.data;
var length = data.length;
var Q = [];
var i = (x+y*width)*4;
@zachleat
zachleat / reading_time.rb
Last active October 21, 2020 23:00
Read this in X minutes Liquid Filter Plugin (for Jekyll)
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@Uroc327
Uroc327 / autoswap_wmctrl.vim
Last active January 1, 2016 10:49 — forked from dprelec/autoswap_linux.vim
This is a version of autoswap_mac.vim from Damian Conway's vim talk that works (or at least tries to) with wmctrl. This does not depend on any stupid titlestrings for vim. Instead it fetches the pid for the swap file and brings the associated window up.
" Vim global plugin for automatin response to swapfiles (from autoswap_mac.vim from Damian Conway)
" Last Change: 2013 Dec 25
" Maintainer: Constantin Runge <uroc327@cssbook.de>
" License: other
if exists("loaded_autoswap")
finish
endif
let loaded_autoswap = 1
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@timohausmann
timohausmann / Vector.js
Last active October 13, 2015 15:56
Vector JS
/**
* Vector Lib
* @author Timo Hausmann <hello.timohausmann@gmail.com>
* @url https://gist.github.com/timohausmann/9603675
* @licence MIT
* @version 1.0
*/
function Vector(x, y) {
this.x = x,
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active July 3, 2024 02:22
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook