Skip to content

Instantly share code, notes, and snippets.

@RenaudRohlinger
RenaudRohlinger / GsapTicker.jsx
Created September 8, 2022 06:15
Synchronize gsap and r3f raf loop
import React, { useEffect } from 'react'
import gsap from 'gsap'
import { useFrame } from '@react-three/fiber'
// sync gsap raf to r3f raf
gsap.ticker.remove(gsap.updateRoot)
export const GsapTicker = () => {
const pg = React.useRef(0)
gsap.ticker.remove(gsap.updateRoot)
@dsumer
dsumer / TaxRateModel.ts
Last active February 2, 2022 15:07
Apply the correct VAT Rate to your customer in Stripe Checkout
import { Model } from 'objection';
export default class TaxRateModel extends Model {
countryCode!: string;
stripeId!: string;
static tableName = 'tax_rate';
}
@kmelve
kmelve / entries-by-date-this-year.js
Created May 9, 2020 18:23
Structure definition for listing entries by date of the current year for Sanity Studio
import S from '@sanity/desk-tool/structure-builder'
import eachDayOfInterval from 'date-fns/eachDayOfInterval'
import startOfYear from 'date-fns/startOfYear'
import startOfDay from 'date-fns/startOfDay'
import endOfDay from 'date-fns/endOfDay'
let now = new Date()
export default () => S.listItem()
.title('Entries by day this year')
.child(
@kmelve
kmelve / department.js
Created April 15, 2020 07:35
Example of listing documents in Sanity Studio‘s desk structure with real-time listener
export default {
name: 'department',
type: 'document',
title: 'Department',
fields: [
{
name: 'title',
type: 'string',
title: 'Title',
},
const sanityClient = require('@sanity/client');
const crypto = require('crypto');
const {
SANITY_API_TOKEN,
SANITY_PROJECT_ID,
SANITY_DATASET,
SHOPIFY_SECRET
} = process.env;
@marklchaves
marklchaves / forecast.js
Last active January 23, 2021 10:24
How to read in an environment variable on Netlify using a lambda function.
/**
* This was a proof of concept for me to be able to
* retrieve an API key using a Netlify environment variable
* using this lambda function. I spent a lot of time looking
* for a complete example like this--without any luck.
*
* So, here's a step-by-step of what I did.
*
* 1) For this function to work, define the env variable in
* Netlify > Site > Build & Deploy > Environment > Edit Variables
@ChugunovRoman
ChugunovRoman / .gitlab-ci.yml
Created June 18, 2018 14:58
Deploy Electron app with gitlab ci
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/download?job=pages
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/raw/<path_to_file>?job=pages
# Where:
# example.com - domain name your gitlab server
# namespace - your name user on the gitlab
# project - your project
# tag - ref of current job.
# If job run on only by tags, than ref will be named as tag name
# If job run on only master, than ref will be named as "master", i.e.: https://<example.com>/<namespace>/<project>/-/jobs/artifacts/master/download?job=pages
# path_to_file - path to file relative from root workspace folder
@mairh
mairh / Redux-Form-Semantic-UI-React
Last active August 12, 2021 23:03
Semantic-UI-React form validation using redux-form example
// semantic-ui-form.js
import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'semantic-ui-react';
export default function semanticFormField ({ input, type, label, placeholder, meta: { touched, error, warning }, as: As = Input, ...props }) {
function handleChange (e, { value }) {
return input.onChange(value);
}
@Frankie-666
Frankie-666 / Displacementmap image transition.markdown
Created May 30, 2016 10:25
Displacementmap image transition

Displacementmap image transition

Scroll effect / Image transition test for a project using PIXI for Webgl abstraction. Effect is made by drawing the image, scaling x, applying threshold and using that as a mask.

A Pen by Felix Nielsen on CodePen.

License.