Skip to content

Instantly share code, notes, and snippets.

View davidsonfellipe's full-sized avatar
:octocat:
hey ✌🏼

Davidson Fellipe davidsonfellipe

:octocat:
hey ✌🏼
View GitHub Profile
@davidsonfellipe
davidsonfellipe / str.go
Last active December 20, 2015 10:39
str.go
package str
func Reverse(input string) string {
inputLength := len(input)
inverted := make([]rune, inputLength)
for _, char := range input {
LenaJS.grayscale = function(pixels, args) {
for (var i = 0; i < pixels.data.length; i += 4) {
var r = pixels.data[i],
g = pixels.data[i+1],
b = pixels.data[i+2];
pixels.data[i] = pixels.data[i+1] = pixels.data[i+2] = 0.2126*r + 0.7152*g + 0.0722*b;
@davidsonfellipe
davidsonfellipe / imgToCanvas.js
Last active December 18, 2015 23:49
Converter image to canvas, using on LenaJS
//Método do LenaJS que converte uma imagem para o tipo ImageData
LenaJS.getImage = function(img) {
var c = document.createElement('canvas');
c.width = img.width;
c.height = img.height;
var ctx = c.getContext('2d');
ctx.drawImage(img, 0, 0);
function xyz_from_wavelength (ColorTemp, lw, currentCIE) {
var nmMin = 380;
var nmMax = 780;
var degrees = 5;
var XYZ = {x: 0,
y: 0,
z: 0};
function colorCIEXYZtosRGB(XYZ) {
var RGBTEMP = {R:0,
G:0,
B:0};
RGBTEMP.R = 3.2404542 * XYZ.X - 1.5371385 * XYZ.Y - 0.4985314 * XYZ.Z;
RGBTEMP.G =-0.9692660 * XYZ.X + 1.8760108 * XYZ.Y + 0.0415560 * XYZ.Z;
RGBTEMP.B = 0.0556434 * XYZ.X - 0.2040259 * XYZ.Y + 1.0572252 * XYZ.Z;
var Canvas = function(canvas){
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.imageData = this.ctx.getImageData(0, 0, canvas.width, canvas.height);
this.data = this.imageData.data;
};
function load(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = onReady;
function onReady() {
if(xhr.readyState < 4 || xhr.status !== 200) {
return;
$ workon default
$ brew install jpeg
$ pip install --upgrade --no-install PIL
$ vim $VIRTUAL_ENV/build/PIL/setup.py
-> JPEG_ROOT = '/usr/local/Cellar/jpeg/8d/'
-> FREETYPE_ROOT = libinclude('/usr/X11')
@davidsonfellipe
davidsonfellipe / gist:4601852
Last active December 11, 2015 12:38
CSS FTW

#CSS FTW My way to face the challenge: Maintainable + Efficient + Optimized

##General

  • YSlow + Page Speed (Performance Rules)…
  • CSSLint Rules…
  • Don’t use too many web fonts talk to your designer, and explain the impact of loading many sources.

##Tools