Skip to content

Instantly share code, notes, and snippets.

View comradebeck's full-sized avatar
🎯
Focusing

Richard Navarro comradebeck

🎯
Focusing
  • Cebu Philippines
View GitHub Profile
@comradebeck
comradebeck / eslint_prettier_airbnb.md
Created January 25, 2024 13:04 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@comradebeck
comradebeck / json-processor.js
Created February 8, 2023 07:58 — forked from jozefcipa/json-processor.js
Process large JSON files with streams
import fs from 'fs'
import { Transform } from 'stream'
import JSONStream from 'JSONStream'
// Custom transform stream
const transformer = new Transform({
objectMode: true,
transform(jsonItem, encoding, callback) {
// your logic goes here...
// const updatedItem = {}
if ($source->getImageColorspace() == Imagick::COLORSPACE_CMYK) {
$source->setImageFormat($fileInfo['extension']);
$tmprealpath = $sourceDirectory;
$tmp = $tmprealpath . '/' . md5($fileInfo['filename']) . ".".$fileInfo['extension'];
$cmyk = true;
// then we add an RGB profile
$icc_rgb = file_get_contents(realpath('assets/color profiles/AdobeRGB1998.icc'));
$source->profileImage('icc', $icc_rgb);
$source->transformImageColorspace(Imagick::COLORSPACE_RGB);
@comradebeck
comradebeck / 0.md
Created August 6, 2018 03:50 — forked from max-mapper/0.md
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@comradebeck
comradebeck / vanilla-js-cheatsheet.md
Created April 3, 2018 02:10 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@comradebeck
comradebeck / elasticsearch-cheatsheet.txt
Created December 10, 2017 14:17 — forked from stephen-puiszis/elasticsearch-cheatsheet.txt
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
@comradebeck
comradebeck / local.xml
Created November 19, 2017 13:53 — forked from Maksold/local.xml
Magento XML - local.xml boilerplate
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->
@comradebeck
comradebeck / install_ffmpeg_ubuntu.sh
Created June 12, 2017 01:22 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@comradebeck
comradebeck / num-cpus.php
Created June 7, 2017 07:49 — forked from ezzatron/num-cpus.php
Function to detect number of CPUs in PHP
<?php
/**
* Copyright © 2011 Erin Millard
*/
/**
* Returns the number of available CPU cores
*
* Should work for Linux, Windows, Mac & BSD