Skip to content

Instantly share code, notes, and snippets.

View herlon214's full-sized avatar
🚀

Herlon Aguiar herlon214

🚀
View GitHub Profile
@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active March 9, 2024 12:03
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js

@houtianze
houtianze / java2smali.bat
Last active September 7, 2022 22:13
Windows batch file to convert .java file to .smali
:: http://stackoverflow.com/a/29052019/404271
echo JDK 7 is required
if not x%1==x goto doit
:usage
echo %~n0 ^<Java file without .java extension^>
goto end
:doit
@eteeselink
eteeselink / delay.js
Created November 13, 2015 13:55
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
@dimitardanailov
dimitardanailov / sample-nginx.conf
Last active June 3, 2021 17:30
Configuration for single page application(Framework: Angularjs, Web server: Nginx)
server {
listen 80 default deferred;
server_name myapp.com;
root /var/www/project-folder/;
# Nginx and Angularjs with html mode 5 - https://gist.github.com/cjus/b46a243ba610661a7efb
index index.html;
@maxivak
maxivak / 00. tutorial.md
Last active April 12, 2024 05:42
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
@nghuuphuoc
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@RobinUS2
RobinUS2 / output-transparent-pixel.go
Created November 25, 2013 11:23
Output a 1x1 transparent gif pixel in Go webserver response. Please note, this is only the relevant code, does not work "out-of-the-box".
import (
"fmt"
"net/http"
"time"
)
const transPixel = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B"
func pixelHandler(w http.ResponseWriter, r *http.Request) {
// Pixel
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@justlaputa
justlaputa / jenkins-api.md
Last active September 26, 2023 17:43
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close