Skip to content

Instantly share code, notes, and snippets.

View pinglinh's full-sized avatar
🥸
hermit

pinglinh pinglinh

🥸
hermit
  • pinglinh corporation
  • Earth
View GitHub Profile
@nataliemarleny
nataliemarleny / .gitconfig
Last active October 19, 2021 09:50
Niche git commands which I won't remember aliases for
[user]
name = <ur-name>
email = <ur-email>
[core]
editor = vim -f
excludesfile = /Users/<name-of-mac>/.gitignore_global
[color]
ui = true
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 10, 2024 12:07
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@claritee
claritee / wwc-tutorials.md
Last active April 15, 2021 05:00
Claire's Women Who Code Tutorials

This is a list of tutorials I've written for the Ruby workshops I run for Women Who Code in London

@ankurk91
ankurk91 / bash_profile.md
Last active October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@david-meza
david-meza / roman_numerals.rb
Last active November 9, 2023 10:01
Convert arabic to roman numerals in Ruby
class Fixnum
# Constant variable with 'unique' roman numerals, plus some special cases (e.g. "IV, IX, XC, CM...")
ROMANS = { 1000 => "M",
900 => "CM",
500 => "D",
400 => "CD",
100 => "C",
90 => "XC",
50 => "L",
@niksumeiko
niksumeiko / git.migrate
Last active May 10, 2024 02:41
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@leonardoeloy
leonardoeloy / reasons_to_use_ci_cd.md
Last active November 6, 2018 12:46
Reasons to use CI/CD

Reasons to use CI/CD

Recently, I've been asked by a group of people to provide arguments that should convince developers and managers to use a CI/CD infrastructure. If you're a developer and you haven't been frozen in an icy lake somewhere in Greenland for the past 8-10 years, you don't need to be convinced. Please, move on. You'll only read what you're used to do daily. And to thank you for stopping by, here's a nice photo of a dog:

We all don't

So, if you're still here, it means you're in doubt of how CI/CD will play a role in our software development utility belt. Although we all know that automated tests and even a simple CI/CD infrastructure are the foundation of modern software development practices, I wasn't able to answer their questions right on spot. I mean, it's obvious that what we do has benefits, but we still don't know how to quantify them. Often, we see folks banging their heads against the wall trying to figure out _wh

@gotomypc
gotomypc / reverse-ip-lookup.js
Created October 27, 2012 08:54 — forked from eugenehp/reverse-ip-lookup.js
node.js IP reverse lookup
var dns = require('dns');
function reverseLookup(ip) {
dns.reverse(ip,function(err,domains){
if(err!=null) callback(err);
domains.forEach(function(domain){
dns.lookup(domain,function(err, address, family){
console.log(domain,'[',address,']');
console.log('reverse:',ip==address);
@Kerrick
Kerrick / fizzbuzz.rb
Created April 24, 2012 20:36
Different solutions for Fizz Buzz in Ruby
def fizz_buzz_1(max)
arr = []
(1..max).each do |n|
if ((n % 3 == 0) && (n % 5 == 0))
arr << "FizzBuzz"
elsif (n % 3 == 0)
arr << "Fizz"
elsif (n % 5 == 0)
arr << "Buzz"
else