Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Being a Nerd...

Uilque Messias uqmessias

🤓
Being a Nerd...
View GitHub Profile
@uqmessias
uqmessias / ogl_osx.md
Created Jun 19, 2018 — forked from v3n/ogl_osx.md
GLFW on OS X starting guide
View ogl_osx.md

OpenGL Development on OS X

While it's possible to download packages and install them manually, it's such a hassle. Fortunately for us, OS X has an unofficial package manager called http://brew.sh Let's install it. Open you Terminal and paste the following code:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Great. Homebrew will automatically install packages to /usr/local. Conveniently, that directory is already in your include and link paths.

@uqmessias
uqmessias / easing.js
Created Jun 14, 2018 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
View easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@uqmessias
uqmessias / easing.js
Created Jun 14, 2018 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
View easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@uqmessias
uqmessias / move-files-back.js
Last active Apr 23, 2018
Script to rename and organize all files from my Onedrive photo folder
View move-files-back.js
const fs = require('fs');
const albumPath = '/home/uqmessias/OneDrive/Imagens/Álbum\ da\ Câmera';
const albumNewPath = '/home/uqmessias/development/rename-files/files';
const handleFile = (dirPath, fileName) => {
const fileOldPath = `${dirPath}/${fileName}`;
const stats = fs.statSync(fileOldPath);
const fileNewPath = `${albumNewPath}/${fileName}`;
const atime = new Date(stats.atimeMs);
const mtime = new Date(stats.mtimeMs);
View index.canvas.html
<html>
<head>
<title>Bouncing Circles</title>
<script>
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
@uqmessias
uqmessias / README.md
Last active Apr 4, 2018
Exercício de turnos
View README.md

Problema

Janio trabalha em uma empresa em três turnos sequenciais (manhã, tarde e a noite). Ele trabalha dois dias em cada turno e quando trabalha no último turno (noite), tem dois dias de folga (folga).

Nos dias 02 e 03 de Abril ele trabalha no turno da manhã. Dado um primeiro dia do primeiro turno (02/04/2018 para o turno da manhã) e a quantidade de terças-feira seguintes (5 por exemplo), devolva as próximas terças-feira e em quais ele poderá participar da sessão de programação.

As sessões acontecem à noite e por isso nos dias de terça-feira em que ele trabalha à noite, não poderá participar da sessão.

@uqmessias
uqmessias / .gitconfig
Last active Jul 23, 2019
My default .gitconfig with some alias
View .gitconfig
[user]
name = Uilque Messias
[alias]
graph = log --graph --oneline --all --decorate --stat
graphall = log --graph --all --decorate --stat
pull = pull --rebase
graphline = log --graph --oneline --all --decorate
delbranch = "!f() { git push origin :\"$1\" --no-verify && git branch -d \"$1\"; }; f"
contributors = shortlog -s -n --no-merges
@uqmessias
uqmessias / all-png-to-svg.sh
Created Mar 13, 2018
Single line command to convert all png in the current directory to svg files.
View all-png-to-svg.sh
( set -x ; for f_png in *.png ; do f="${f_png%.png}" ; convert "$f_png" -flatten "$f.pgm" && potrace "$f.pgm" -s -o "$f.svg" ; done )
View date-to-period.js
// @flow
export type TimePeriod = 'am' | 'pm';
export type TimeOfTheDay = { hour: number, minute: number, period: TimePeriod };
const getTimeOfTheDay = (date: Date): TimeOfTheDay => ({
hour: date.getHours() > 12 ? date.getHours() - 12 : date.getHours(),
minute: date.getMinutes(),
period: date.getHours() >= 12 ? 'pm' : 'am',
});
@uqmessias
uqmessias / logNavigationRoute.js
Last active Mar 5, 2018
This is a function to log (in form of a tree) the navigation based on `react-navigation` and redux state of this navigation.
View logNavigationRoute.js
type NavigationRoute = {
index?: ?number,
routeName: string,
routes?: ?Array<NavigationRoute>,
};
type FormattedState = {
children: Array<FormattedState>,
routeName: string,
You can’t perform that action at this time.