Skip to content

Instantly share code, notes, and snippets.

View magalhaespaulo's full-sized avatar

magalhaespaulo

View GitHub Profile
@AndrewWCarson
AndrewWCarson / getWordsFromPhoneNumber.py
Created July 11, 2021 09:32
A simple python solution to the phone number word search problem here: https://www.youtube.com/watch?v=PIeiiceWe_w
#!/usr/bin/env python
import math
# Function: numberFromWord
# - wordString: a String representative of the word
# Returns:
# - number: an Integer representative of the screen based on map
def numberFromWord(wordStr):
phoneMap = {"a": 2, "b": 2, "c": 2,
@aleclarson
aleclarson / rollup-typescript.md
Last active May 6, 2024 19:37
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking
🧐 Source maps

Install

@coleturner
coleturner / framer-motion-use-viewport-scroll-with-element-container.md
Last active February 5, 2024 09:46
(Framer Motion): useViewportScroll with element container

Demo

Context

useViewportScroll is a great way to create a parallax effect as the page scrolls. In some cases however, we only want to scroll when an element is in the viewport area.

So for example, if we have a "landscape" scene, and want to animate the Sun object only when it's in view, we start with our useViewportScroll implementation:

function Sun(props) {
 const { scrollY, scrollYProgress } = useViewportScroll();
palindromeGif() {
if [[ -n "$1" ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
if [[ $2 != '--big' ]]; then
a=$(ls out-static* | wc -l)
for p in $(ls -r out-static*);
do
out=$(printf "out-static-%05d.png" $a)
let "a++"
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;