Skip to content

Instantly share code, notes, and snippets.

Avatar
3 cups required

@greweb gre

3 cups required
View GitHub Profile
@gre
gre / easing.js
Last active Sep 27, 2021
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
View easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: t => t,
// accelerating from zero velocity
easeInQuad: t => t*t,
// decelerating to zero velocity
@gre
gre / scrollparent.js
Created Aug 3, 2016
get first parent scrollable container of a dom element
View scrollparent.js
// more minimal version of https://github.com/olahol/scrollparent.js/blob/master/scrollparent.js
const regex = /(auto|scroll)/;
const style = (node, prop) =>
getComputedStyle(node, null).getPropertyValue(prop);
const scroll = (node) =>
regex.test(
style(node, "overflow") +
style(node, "overflow-y") +
@gre
gre / gist:4744775
Created Feb 9, 2013
Convert all *.wav in .mp3 and .ogg (useful for HTML5 audio support on all browsers...)
View gist:4744775
for f in *.wav; do sox $f ${f%%.wav}.mp3; sox $f ${f%%.wav}.ogg; done
View article.md

What is GL-Transitions?

The GL-Transitions.com initiative aims to build an Open Collection of GLSL Transitions. It aims to be highly community-driven and free-software.

View image-seizure-effect.frag
precision highp float;
varying vec2 uv;
uniform float time;
uniform sampler2D img;
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ) {
return a + b*cos( 6.28318*(c*t+d) );
}
vec3 color (float t) {
return palette(
t,
View bitcoin-seizure.frag
precision highp float;
varying vec2 uv;
uniform float time;
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ) {
return a + b*cos( 6.28318*(c*t+d) );
}
vec3 color (float t) {
return palette(
@gre
gre / Application.scala
Created Nov 12, 2012
Generate Zip on-the-fly with Play!> Framework (2.1+)
View Application.scala
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def zip = Action {
import play.api.libs.iteratee._
import java.util.zip._
@gre
gre / ethereum_ledger_integration.md
Last active Jul 14, 2020
Quick Guide for Ethereum Ledger Integration
View ethereum_ledger_integration.md

How to integrate the Ledger device with a Ethereum Web Application

This is a quick guide to show how to integrate Ledger Ethereum libraries into an existing web application.

If you are starting a new DApp project from scratch, or simply are beginning in this Ethereum Smart Contract world, we have made create-dapp Starter Kit for you, it comes with a out-of-the-box support of Ledger and MetaMask and shows a complete smart contract example (that allows to get/set a value globally).

Whether you want to integrate on an existing app or bootstrap it from scratch with our starter kit, the follow guide will drive you to important part on how things work with the Ledger.

Prerequisites of the guide

@gre
gre / cube.glsl
Created Jun 12, 2014 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
View cube.glsl
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
uniform float persp;
uniform float unzoom;
uniform float reflection;
@gre
gre / EasingFunctions.json
Last active Feb 26, 2020
DEPRECATED Please use http://github.com/gre/bezier-easing for latest vrrsion.
View EasingFunctions.json
{
"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]
}