Skip to content

Instantly share code, notes, and snippets.

Avatar

Luigi De Rosa luruke

View GitHub Profile
@luruke
luruke / .slate
Created Apr 8, 2015
my slate conf
View .slate
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Resize Bindings
#bind right:alt resize +10% +0
#bind left:alt resize -10% +0
@luruke
luruke / barba_wikipedia.js
Created Feb 7, 2016
Add barba on wikipedia
View barba_wikipedia.js
// Barba wikipedia.org
var js = document.createElement('script');
js.type = 'text/javascript';
js.onload = initBarba;
js.src = 'https://luruke.github.io/barba.js/dist/barba.min.js';
document.body.appendChild(js);
function initBarba() {
Barba.Pjax.Dom.parseContainer = function(el) {
return el.querySelector('#content');
@luruke
luruke / smashingmagazine.js
Last active Jan 12, 2022
Source code of the demo "Improving User Flow Through Page Transitions" on Smashing Magazine.
View smashingmagazine.js
/*
https://www.smashingmagazine.com/2016/07/improving-user-flow-through-page-transitions/
You can copy paste this code in your console on smashingmagazine.com
in order to have cross-fade transition when change page.
*/
var cache = {};
function loadPage(url) {
if (cache[url]) {
@luruke
luruke / README.md
Last active Mar 7, 2018
Looking for a new maintainer for barba.js
View README.md

About two years ago I published Barba.js, a little unopinionated library for push state navigation. The library has now reached 6k stars and it's widely used by agencies and independents.

Unfortunately for different reasons I don't have much time to dedicate to the project, but at the same time it's a shame let the project die, while it's still so used from many people.

I'm looking for an active maintainer, that is already using barba.js and that can take care of the project, keep it alive and let it evolve.

Of course I can give some advice and help to keep the nature of the project consistent.

View ObjectPool.js
export default class ObjectPool {
constructor(options = {}) {
this.options = Object.assign({
number: 10,
Create() {
return {};
},
}, options);
this.available = [];
@luruke
luruke / bunny.js
Created Oct 27, 2018
draw bunny on terminal
View bunny.js
const drawille = require('drawille')
const bunny = require('bunny')
const glmatrix = require('gl-matrix')
const width = 200
const height = 200
const canvas = new drawille(width, height)
const mat4 = glmatrix.mat4
const vec3 = glmatrix.vec3
let points = []
@luruke
luruke / PostFX.js
Last active Jan 26, 2022
Simple example of postprocessing in three.js
View PostFX.js
/*
To use it, simply declare:
`const post = new PostFX(rendering);`
Then on update, instead of:
`rendering.render(scene, camera);`
replace with:
`post.render(scene, camera);`
*/
import {
View IosUnlock.js
/**
* Try to fix iOS lock on audio.
*
* By default, audio on iOS is locked until a sound is played within a user interaction,
* and then it plays normally the rest of the page session.
*/
// Inspired from https://github.com/goldfire/howler.js/blob/2.0/src/howler.core.js#L212
export default class IosUnlock {
View wecargo3d.js
// Button DOM
<a href="#" data-component="trackable" data-type="button">Yo, button</a>
// Trackable kapla component (https://github.com/thierrymichel/kapla)
// Using it just to track when some dom is "mounted/unmounted"
import { Component } from 'kapla';
import dom from 'gl/dom';
export default class extends Component {
init() {
View glitchfbo.js
import {
NearestFilter,
RepeatWrapping,
} from 'three';
import FBO from '../utils/fbo';
import textures from 'gl/utils/textures';
import trail from '../utils/trail';
import bidello from 'bidello';