Skip to content

Instantly share code, notes, and snippets.

View jancassio's full-sized avatar
:octocat:
Loading...

Jan Cassio jancassio

:octocat:
Loading...
View GitHub Profile
@jancassio
jancassio / SmoothScroller.svelte
Last active February 27, 2024 09:43
Svelte Smooth Scroller Component
<!--
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.
/**
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) {
@jancassio
jancassio / README.md
Last active March 6, 2020 11:26
React Hooks

React Hooks

useImage

Provides an image from a respective URL

Usage

const Component = ({ src, alt, width = 320, height = 240, fallback }) => {
@jancassio
jancassio / i18n.js
Created February 10, 2019 14:58
Dead simple JavaScript i18n implementation
// 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.
*
@jancassio
jancassio / making-animated-gifs-from-openframeworks-and-ffmpeg.md
Last active October 8, 2023 00:59
Making animated gifs from openframeworks using FFMPEG

Making animated gifs from Openframeworks using FFMPEG

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:

  1. Setup resolution
  2. Setup framerate

Keybase proof

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:

@jancassio
jancassio / averageColor.pde
Last active September 25, 2019 23:02
Get average color of an image
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]);
@jancassio
jancassio / GoogleMapsLinkBuilder.swift
Created November 18, 2016 17:07
A simple protocol and some concrete implementations to generate links to be opened in some of common Map based apps for iOS
// The MIT License (MIT)
// Copyright (c) 2016 Jan Cássio
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jancassio
jancassio / StringMaskr.swift
Created August 19, 2016 17:43
Simple string formatter based on mask string
//
// StringMask.swift
// StringMask
//
// Created by Jan Cássio on 8/19/16.
// Copyright © 2016 Jan Cassio. All rights reserved.
//
import Foundation
@jancassio
jancassio / xcode_ramdisk.sh
Created June 14, 2016 22:13 — forked from skeeet/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"