Skip to content

Instantly share code, notes, and snippets.

@MoonTahoe
MoonTahoe / upload.yaml
Last active April 16, 2024 21:40
Github Action to build iOS app with expo and upload to testflight
# Just place this file in your repo under the .github/workflows folder.
# You set all of the secrets in the setting of the repo
name: Deploy to Testflight
# When a pull request is closed...
# This is because this action commits back to the repository
# so setting this on a push would cause an infinite loop of commits
# unless you pragmatically check the contents of the repo or something
@nicolasblanco
nicolasblanco / app.js
Last active September 18, 2023 19:50
Stripe.js elements integration inside a Elixir LiveView (Bootstrap styles)
// Code handling the card payment
const payWithCard = function (stripe, card, clientSecret, liveView) {
stripe
.confirmCardPayment(clientSecret, {
payment_method: {
card: card,
},
})
.then(function (result) {
if (result.error) {
@kjintroverted
kjintroverted / IGBackground.js
Last active October 16, 2019 18:23
A simple React component that creates a tiled background of recent posts from Instagram.
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import PropTypes from 'prop-types';
const IGBackground = ({ username, quality, filterOpts = [] }) => {
const [imageResources, setImages] = useState(null);
const [imageDims, setImageDims] = useState(0);
// CALCULATE HOW WIDE THE TILES SHOULD BE
@drewm
drewm / shoot-sharing-image.js
Last active April 30, 2021 06:24
Dynamic Social Sharing Images
const puppeteer = require('puppeteer');
const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');
// Get the URL and the slug segment from it
const url = process.argv[2];
const segments = url.split('/');
const slug = segments[segments.length-2];
(async () => {
@animoplex
animoplex / LoopExpression.jsx
Created September 4, 2018 01:57
Loop Expression - After Effects Expression by Animoplex
// Loop Expression - Created by Animoplex: www.animoplex.com
// Basic loop expressions for use on a property in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=XRrs9pvWGuY
// Loop Examples
loopOut("cycle", 0) // Repeat from start to finish. Default loop mode.
loopOut("pingpong", 2) // Loops last three keyframes back and forth.
loopOut("offset", 0) // Repeats animation using last keyframe as new start point.
loopOut("continue") // Does not loop, but continues onwards with current velocity.
@CodingDoug
CodingDoug / README.md
Last active November 6, 2022 09:29
Example code from the video "Use async/await with TypeScript in Cloud Functions"

Example code from the video "Use async/await with TypeScript in Cloud Functions"

This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.

Watch the video here

The code in this project is licensed under the Apache License 2.0.

Copyright 2018 Google LLC
@Fabiantjoeaon
Fabiantjoeaon / scroll.js
Last active November 6, 2019 19:01
Vanilla JS (ES6) smooth scrolling w/ Easing functions
const scrollToItemId = (containerId, srollToId) => {
const scrollContainer = document.getElementById(containerId);
const item = document.getElementById(scrollToId);
//with animation
const from = scrollContainer.scrollTop;
const by = item.offsetTop - scrollContainer.scrollTop;
if (from < item.offsetTop) {
if (item.offsetTop > scrollContainer.scrollHeight - scrollContainer.clientHeight) {
by = (scrollContainer.scrollHeight - scrollContainer.clientHeight) - scrollContainer.scrollTop;
@pirate
pirate / parseURLParameters.js
Last active December 15, 2023 07:17
Parse URL query parameters in ES6
function getUrlParams(search) {
const hashes = search.slice(search.indexOf('?') + 1).split('&')
const params = {}
hashes.map(hash => {
const [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}
@DavideMontersino
DavideMontersino / private-fork.md
Last active February 27, 2024 12:56
How to fork to a private gitlab instance

Theory:

your git repository can have more than one remote server; In this case we want to have two:

  1. one for our private repository on gitlab (will be the default one, called origin)
  2. one to be connected to the source repo on github, to be able to pull new changes (will be called upstream)

How to make a private fork from github to gitlab

@mandiwise
mandiwise / Update remote repo
Last active May 15, 2024 09:50
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket