Skip to content

Instantly share code, notes, and snippets.

View zazk's full-sized avatar
:octocat:
Let's talk about Javascript & DevOps

Enrique Juan de Dios zazk

:octocat:
Let's talk about Javascript & DevOps
View GitHub Profile
@tannerlinsley
tannerlinsley / useGlobalMemo.js
Created August 28, 2020 23:45
useGlobalMemo is a React hook that lets you share memoizations across an entire app using a unique key.
const cache = {}
export default function useGlobalMemo (key, fn, deps) {
if (!cache[key]) {
cache[key] = {
subs: 0,
deps,
value: fn(),
}
@lucj
lucj / k3s-multipass.sh
Created December 17, 2019 21:16
Setup a k3s kubernetes cluster using Multipass VMs
for node in node1 node2 node3;do
multipass launch -n $node
done
# Init cluster on node1
multipass exec node1 -- bash -c "curl -sfL https://get.k3s.io | sh -"
# Get node1's IP
IP=$(multipass info node1 | grep IPv4 | awk '{print $2}')
@erdostom
erdostom / Dockerfile
Last active November 25, 2022 14:53
Good starter Dockerfile + docker-compose.yml for Rails 6.
FROM ruby:2.6.5-alpine
RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn
RUN gem install bundler:2.1.4
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --check-files
@f3nry
f3nry / protoc-gen-go.sh
Created February 1, 2019 01:12
Generating proto Go code from a definition
brew install protobuf
go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/protoc-gen-go
protoc -I=./api --go_out=plugins=grpc:./api ./api/hello.proto
@dmlittle
dmlittle / matches.csv
Created June 17, 2018 00:20
2018 FIFA Worldcup API
StageName GroupName Date StadiumName HomeTeamName AwayTeamName DataUrl
First stage Group A 2018-06-14T15:00:00Z Luzhniki Stadium Russia Saudi Arabia https://api.fifa.com/api/v1/live/football/17/254645/275073/300331503
First stage Group A 2018-06-15T12:00:00Z Ekaterinburg Arena Egypt Uruguay https://api.fifa.com/api/v1/live/football/17/254645/275073/300353632
First stage Group B 2018-06-15T15:00:00Z Saint Petersburg Stadium Morocco IR Iran https://api.fifa.com/api/v1/live/football/17/254645/275073/300331526
First stage Group B 2018-06-15T18:00:00Z Fisht Stadium Portugal Spain https://api.fifa.com/api/v1/live/football/17/254645/275073/300331524
First stage Group C 2018-06-16T10:00:00Z Kazan Arena France Australia https://api.fifa.com/api/v1/live/football/17/254645/275073/300331533
First stage Group D 2018-06-16T13:00:00Z Spartak Stadium Argentina Iceland https://api.fifa.com/api/v1/live/football/17/254645/275073/300331515
First stage Group C 2018-06-16T16:00:00Z Mordovia Arena Peru Denmark https://api.fifa.com/
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 20, 2024 07:49 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@RichardBray
RichardBray / gulp-to-webpack.md
Last active November 3, 2022 18:51
Moving from Gulp to Webpack

Moving from Gulp to webpack

I've been avoiding learning Webpack for a while now as I never thought I needed to learn another build tool, Gulp does everything I'd ever need from a build tool now or in the future. However, ever since we've moved from AngularJS to Angular (or Angular 2+) as well as introducing standards such as; TypeScript instead of Javascript and a Jasmine/Karma combo for UI testing, but also Webpack as an initial build tool. I've avoided it for long enough and now, in September 2017, I thought it's time to finally move on from my old friend Gulp.

Good Old Gulpfile

If you've never heard of Gulp before, this isn't the post to learn, there are plenty of good tutorials out there a Google search away. Then again, you don't really need to know Gulp to understand what's going on so feel free to continue reading nevertheless.

[Here's wh

@geraldvillorente
geraldvillorente / import.md
Created June 14, 2017 05:03
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

@NikitaKozlov
NikitaKozlov / generator.py
Last active October 17, 2021 15:20
Simple Java class generator
import sys, os, shutil
def generateClass(directory, classNumber, methodsPerClass, mainPackage):
className = "Foo" + str(classNumber)
filePath = os.path.join(directory, className + ".java")
with open(filePath,"w+") as f:
f.write("package " + mainPackage + "." + directory + ";\n")
f.write("public class " + className + " {\n")
for i in xrange(0, methodsPerClass):
f.write("public void foo" + str(i) + "(){\n")
@powerc9000
powerc9000 / creating_ios_archives.md
Created July 19, 2016 06:10
Creating and uploading iOS archives from the command line.

I don't like IDEs. I want to code in my editor and use the command line for everything else. I like the flow better and it feels faster to me.

I also like to have one command to do several things I want to do.

I don't want to open Xcode to create an archive, then open the archive window, then upload the archive to iTunes. It's slow and breaks my flow.

Also, in react native, it's trivial to build Android releases on the command line. I want to create and upload both iOS and android from the command line.

So after hours of searching the internet I found a flow I like for creating and uploading archives for iOS all from the command line