Skip to content

Instantly share code, notes, and snippets.

Avatar
💦
Recovering

Plusb Preco preco21

💦
Recovering
View GitHub Profile
@preco21
preco21 / cloudSettings
Last active Aug 18, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-08-18T12:16:37.965Z","extensionVersion":"v3.4.3"}
@preco21
preco21 / cloudSettings
Last active Dec 19, 2019
Visual Studio Code Settings Sync Gist (old)
View cloudSettings
{"lastUpload":"2019-12-19T17:39:44.259Z","extensionVersion":"v3.4.3"}
@preco21
preco21 / aqua.alfredappearance
Last active May 23, 2018
Aqua theme with pastel and blue cocktail
View aqua.alfredappearance
{
"alfredtheme" : {
"result" : {
"textSpacing" : 5,
"subtext" : {
"size" : 12,
"colorSelected" : "#F5F5F5CC",
"font" : "System",
"color" : "#F5F5F566"
},
@preco21
preco21 / cloudSettings
Last active Dec 19, 2019
Visual Studio Code Settings Sync Gist (old)
View cloudSettings
{"lastUpload":"2019-12-19T21:43:21.555Z","extensionVersion":"v3.4.3"}
@preco21
preco21 / calcMargin.js
Last active Aug 21, 2017
A simple `calcMargin()`
View calcMargin.js
export default function calcMargin(obj = {}) {
if (Number.isInteger(obj)) {
return {
top: obj,
right: obj,
bottom: obj,
left: obj,
};
}
@preco21
preco21 / obj-key-values.js
Created May 25, 2016
Iterate over object key values
View obj-key-values.js
// ES2015
for (const key of Object.keys(obj)) {
console.log(key); // key
console.log(obj[key]); // value
}
// ES2016
for (const value of Object.vaules(obj)) {
console.log(value); // value
}
@preco21
preco21 / FPSCounter.js
Last active Jun 8, 2016
A simple fps counter
View FPSCounter.js
import getTimeMethod from './getTimeMethod';
class FPSCounter {
constructor() {
this._getTime = getTimeMethod();
this._fps = 0;
this._prevTime = 0;
this._frames = 0;
this.startTick();
@preco21
preco21 / getYearDays.js
Last active Aug 5, 2016
Get leap year days
View getYearDays.js
function getYearDays(year) {
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
return isLeapYear ? 366 : 365;
}
export {
getYearDays as default,
};
@preco21
preco21 / .gitignore
Last active Jun 8, 2016
Git dotfile templates for BabelJS environment
View .gitignore
.DS_Store
node_modules
npm-debug.log
/bin
@preco21
preco21 / benchmark-copy-array.js
Last active Aug 5, 2016
Benchmark various methods to copy array in ES2015
View benchmark-copy-array.js
import {Suite} from 'benchmark';
const suite = new Suite();
suite
.add('Array Spread Operator', () => {
const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
const b = [...a];
})
.add('Array.from()', () => {