Skip to content

Instantly share code, notes, and snippets.

View prisme's full-sized avatar

Jérémy Saint-Prix prisme

View GitHub Profile
@prisme
prisme / fullframe.js
Created April 30, 2013 14:03
"full-frame" resize handling jQuery plugin : resizing/centering/cropping an asset in its parent, according to their respective ratio. parent needs an overflow:hidden
$.fn.centerIn = function (parent) {
var parentHeight = parent.height(),
parentWidth = parent.width(),
assetHeight = this.height(),
assetWidth = this.width(),
parentRatio = parentWidth / parentHeight,
assetRatio = assetWidth / assetHeight;
//----> ratio
if ( parentRatio < imgRatio ) {
@prisme
prisme / amd-easing.js
Last active February 11, 2024 22:10
easing AMD module
define([], function() {
//use: module.easeInExpo( time, beginning value, change in value, duration );
return {
linear: function (t, b, c, d) {
return (t==0) ? b : c*(t/=d) + b;
},
easeInQuad: function (t, b, c, d) {
return c*(t/=d)*t + b;
},
/*
*
* Works with elements or jquery
*
* scrollTo(element, duration, offset);
*
* Update 'scroller' variable with custom scrolling element if not document.body
*
*/
@prisme
prisme / gist:d85da2a29f971c355ac7
Last active August 29, 2015 14:19
fast prototype
npm install -g beefy
mkdir proto && cd proto
touch index.js
npm init
npm install installify
beefy index.js -- -t installify
# open devtools
# add folder to workspace
# edit index.js e.g. var module = require('anything-from-npm')
@prisme
prisme / blocksToPages.js
Last active September 7, 2015 15:52
Return pages of elements based on available space
/*
*
* Use:
* var pages = blocksToPages(myElement)
* returns array of elements.
*
*/
define([
], function() {
Verifying that +prisme is my blockchain ID. https://onename.com/prisme
@prisme
prisme / lol.sh
Created May 12, 2016 15:01
new proto
#ONCE :
#on your mark
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
#ready
npm i -g cssnext watchify serve opn-cli
#EACH
#steady
mkdir proto & cd proto & touch index.js index.css index.html
#go !
@prisme
prisme / app.js
Created April 18, 2017 08:38
hybrid slices
app.route('/').get(function(req, res){
api(req, res)
.then(function(api) {
api.query( prismic.Predicates.at('document.type', 'home-page') )
.then((pageContent) => {
if (pageContent) {
res.render('index', {
pageContent : pageContent.results[0],
@prisme
prisme / new-slice.md
Created April 18, 2017 14:52 — forked from Duaner/new-slice.md
Include New slices in your nodejs project

#Define


"new-slice" : {
    "type" : "Slice",
    //No repeatable zone
    "non-repeat" : {
      "titre" : {
        "type" : "StructuredText"
      }
 },
@prisme
prisme / mail
Created October 12, 2017 09:12
Bonjour Nathalie
Suite à notre RDV de production hier, voici quelques informations essentielles sur l'événement,
ainsi qu'une présentation du projet en pièce jointe
A votre disposition pour tout complément d'information
Bien à vous
Jérémy Saint-Prix
+33 (0)6 60 80 02 61