Skip to content

Instantly share code, notes, and snippets.

View pimeo's full-sized avatar

Brtrnd Sru pimeo

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.
*/
@Overbryd
Overbryd / rails_admin_and_globalize3.md
Created July 14, 2011 20:31
RailsAdmin and Globalize3

RailsAdmin and Globalize3

I have a project where I need translated content. Therefore I use globalize3, wich stores its translated attributes in a seperate table that belongs to the original model. And I use RailsAdmin for painless record management.

It took me some time to figure out how to get those working together, but eventually I found a solution that is non invasive and still ok to work with.

The translated model

In my case there is a Snippet class. It holds content for static pages or text passages on the website. There is a good README for globalize3 for installation instructions and documentation.

@orioltf
orioltf / check_vars_haml.md
Last active July 6, 2019 23:45
#HAML: Checking variables in partials
  1. Check if a page variable has been defined
    1. Set variables in a page (page.html.haml) at the very biginning of the file:

      ---
      variable: value
      variable2: value 2
      ---
@mbostock
mbostock / .block
Last active March 6, 2024 04:06
Gradient Along Stroke
license: gpl-3.0
@justindmartin
justindmartin / Sigmoid Function.php
Last active February 8, 2019 18:07
This is a sigmoid function in PHP.
<?php
function sigmoid($t){
return 1 / (1 + pow(M_EULER, -$t));
}
?>
@fadhlirahim
fadhlirahim / installing_supervisor_macosx.md
Last active December 31, 2023 14:45
Setting up supervisord in Mac OS X

Installation

Installing Supervisor on OS X is simple:

sudo pip install supervisor

This assumes you have pip. If you don't:

@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active April 21, 2023 17:14
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

"use strict";
/**
* Rupture.js
*
* ------------------------------------------------------------
*
* Available methods:
*
* Rupture.activate()
@shgysk8zer0
shgysk8zer0 / index.php
Last active September 8, 2020 14:49
RSA public key cryptography using PHP >= 7
<?php
//namespace shgysk8zer0\PHPCrypt;
const PUBLIC_KEY = './pub.pem';
const PRIVATE_KEY = './priv.pem';
const PUB2 = './pub2.pem';
const PRIV2 = './priv2.pem';
const PASSWORD = 'dgbdkfjg';
const PASSWORD2 = 'dfgnduyho';
import parseFunction from 'parse-function'
const app = parseFunction({
ecmaVersion: 2017,
})
class DIC {
constructor() {
this.dependencies = {}
this.factories = {}