Skip to content

Instantly share code, notes, and snippets.

View 4gray's full-sized avatar
:octocat:
Focusing

4gray

:octocat:
Focusing
View GitHub Profile
@FreddieOliveira
FreddieOliveira / docker.md
Last active May 11, 2024 10:10
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@xphong
xphong / d3-drag-and-drop.e2e.js
Last active June 23, 2020 09:08
Cypress D3 Svg Drag and Drop
const dataTransfer = new DataTransfer()
cy.window().then((win) => {
cy.get('.dragButton')
.trigger('mousedown', { which: 1, view: win, force: true })
cy.get('.dragButton')
.trigger('dragstart', { dataTransfer, view: win, force: true })
.trigger('drag', { dataTransfer, view: win, force: true })
cy.get('.dropElement')
.trigger('mouseenter', { force: true, view: win })
@xero
xero / semantic-commit-messages.md
Last active August 21, 2023 12:58
bb commit style guide :: how we liven up the commit history

semantic commit messages

see how a minor change to your commit message style can make you a better programmer self generate {docs,changelog}, add context to the changeset, enable filtering (e.g. ignore styling or documentation changes), and liven up the commit history!

format: <type>(<scope>): <ticket> subject :emoji:

  • <scope>
    • optional
    • some changes are global or difficult to assign to a single component
  • ``
@mort3za
mort3za / git-auto-sign-commits.sh
Last active May 7, 2024 01:45
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@monochromer
monochromer / es6-фишки.js
Last active August 26, 2018 20:13
ES6 фишки
// Уникальный массив
const numbers = [1, 2, 1, 1, 2, 1, 3, 4, 1 ]
const uniq = [...new Set(numbers)] // => [ 1, 2, 3, 4 ]
const uniq2 = Array.from(new Set(numbers)) // => [ 1, 2, 3, 4 ]
// Обновление объекта в массиве по свойству
const initial = [ {id: 1, score: 1}, {id: 2, score: 2}, {id: 3, score: 4}]
const newValue = {id: 3, score: 3}
const updated = initial.map(x => x.id === newValue.id ? newValue : x)
@Solomko2
Solomko2 / fileSize.ts
Created August 29, 2017 14:15
fileSize pipe
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'fileSize'
})
export class FileSizePipe implements PipeTransform {
private units = [
'bytes',
'KB',
@oleurud
oleurud / local-mongo-replicaset-with-docker
Last active November 16, 2023 16:57
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019
@pachacamac
pachacamac / codepenclone.html
Created April 29, 2016 12:52
Mini Codepen Clone with sharing function
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MiniCodepenClone</title>
<style>
body,textarea,iframe{ margin:0; box-sizing:border-box; }
textarea,iframe { width:100%; height:50vh; float:left; }
textarea { color:#eee; background:#111; font-family:monospace; font-size:11pt; line-height:1.4; width:33.33%; }
#shareBtn { position:absolute; bottom:0; left:0; }
@topheman
topheman / git-notes.md
Created June 29, 2015 17:39
Git notes cheat sheet