I hereby claim:
- I am jancassio on github.
- I am jancassio (https://keybase.io/jancassio) on keybase.
- I have a public key ASB7EAgy7OiQS7SN1XNbtBqf8Q7vNMGpRkCEjFBsDszyHQo
To claim this, I am signing this object:
| color averageColor(PImage image) { | |
| float r = 0; | |
| float g = 0; | |
| float b = 0; | |
| int count = image.pixels.length; | |
| int[] pixels = image.pixels; | |
| for(int i = 0; i < count; i++) { | |
| r += red(pixels[i]); |
I hereby claim:
To claim this, I am signing this object:
Making gif loops from Openframeworks is really cool but, isn't simple as suppose to be.
Here are the steps I do to make that. Look almost the whole process are mostly mechanical and could be automated.
These steps are:
| // dead stupid simple i18n implementation | |
| /** | |
| * i18n function allows to pick a string from a json (could be yml as well) and render it based on language. | |
| * | |
| * Examples: | |
| * ``` | |
| * const enUS = i18n('en-us'); // load a function that provides all en-us strings. | |
| * const ptBR = i18n('pt-br'); // load a function that provides all pt-br strings. | |
| * |
| /** | |
| Removes accents from strings. | |
| Example: | |
| stripAccents("Jânio Cássio") // outputs Janio Cassio | |
| @param string The string to strip accents with | |
| @return A new string with without accents. | |
| */ | |
| function stripAccents(string) { |
| <!-- | |
| Smooth scroller | |
| Just add any scrollable container inside this component. | |
| Dependencies: | |
| This example depends on GSAP to perform scroll y position across many browsers. It could | |
| be replaced by any function that resolves scroll position for all browsers to cover with. |
It's a port of Sooth Scroller for Svelte for React.
Actually, it requires GSAP, TypeScript & Tailwindcss are optional.
To remove TypeScript, just remove the type marks. To remove Tailwindcss, remove tailwindclasses but don't forget to reproduce the same styles in the elements with pure CSS.
| // | |
| // String+Localized.swift | |
| // | |
| // Created by Jan Cássio on 2021/03/27. | |
| // Copyright © 2021 Jan Cassio. All rights reserved. | |
| // | |
| import Foundation | |
| extension String { |
StatefulPreview is a simple struct wrapped in a PreviewProvider extension that enables stateful previews for SwiftUI views.
Fields wrapped in @Binding annotation, are not easy to preview as stateful value. It's possible to wrap a value using .constant utilty but it will not allow to modify the value.