Skip to content

Instantly share code, notes, and snippets.

View safinn's full-sized avatar

Dimitris Karittevlis safinn

View GitHub Profile
package main
import (
"errors"
"fmt"
"io"
"net/http"
)
var (
let res = {
"totalSuppliers": 58,
page: {
"total": 47,
"offset": 0,
"limit": 5
},
suppliers: []
}
for (let i = 0; i < 5; i++) {
@safinn
safinn / lazy-load-nvm.sh
Created May 17, 2021 14:37
Lazy load NVM for faster shell loading
# https://trick77.com/slow-oh-my-zsh-loading-on-macos-11/
export NVM_DIR="$HOME/.nvm"
nvm_cmds=(nvm node npm yarn npx)
for cmd in $nvm_cmds ; do
alias $cmd="unalias $nvm_cmds && unset nvm_cmds && . $NVM_DIR/nvm.sh && \. $NVM_DIR/bash_completion && $cmd"
done
@safinn
safinn / .js
Last active June 25, 2016 08:38
// Help for: https://www.reddit.com/r/node/comments/4prm4a/async_requests_got_the_best_of_me/
// Add a callback function as a parameter that will allow you to perform what you need to when the request has finished.
function requestExc(callback) {
var resDictionary = {}
unirest.get("http://openapi.ro/api/exchange/" + queryDict["code"] + ".json")
.query({"date" : queryDict["date"]})
.end(function(res) {
if (res.error) {
console.log('GET error', res.error)