Skip to content

Instantly share code, notes, and snippets.

View andremsantos's full-sized avatar

André Santos andremsantos

  • Docinho de Açucar
  • Portugal
View GitHub Profile
@xelaz
xelaz / resize.js
Last active September 5, 2022 07:27
NodeJs resize and optimize images with sharp
const fs = require('fs');
const glob = require('glob');
const sharp = require('sharp');
const Promise = require('bluebird');
const successList = [];
const errorList = {};
glob("wp-content/uploads/**/*.+(jpeg|jpg)", function (er, files) {
Promise.resolve(files)
@scottopolis
scottopolis / splice-object-array.js
Last active January 31, 2023 06:54
Remove object from array of objects in Javascript
// we have an array of objects, we want to remove one object using only the id property
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id of 37
const removeIndex = apps.findIndex( item => item.id === 37 );
// remove object
apps.splice( removeIndex, 1 );
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}