Skip to content

Instantly share code, notes, and snippets.

View ycmjason's full-sized avatar
😆

YCM Jason ycmjason

😆
View GitHub Profile
@ycmjason
ycmjason / asyncStringReplace.js
Created April 24, 2018 21:47
Async version of `string.prototype.replace`
const asyncStringReplace = async (str, regex, aReplacer) => {
regex = new RegExp(regex, regex.flags + regex.flags.includes('g')? '': 'g');
const replacedParts = [];
let match;
let i = 0;
while ((match = regex.exec(str)) !== null) {
// put non matching string
replacedParts.push(str.slice(i, match.index));
// call the async replacer function with the matched array spreaded
replacedParts.push(aReplacer(...match));
@blake-newman
blake-newman / unique-id-generation-workflow.yml
Last active October 18, 2023 15:26
Github action workflow generating a unique id
name: My workflow
on: [pull_request]
jobs:
build_id:
steps:
- name: 'Set build id'
id: build_id
# add a step output `steps.build_id.outputs.id` as the unique id
@hectorperez
hectorperez / copy word under cursor in Vim.txt
Created August 7, 2014 13:37
copy word under cursor in Vim
copy/delete word under cursor in Vim
yw / byw
Assuming that the cursor is at the first character of the word simply do this in command mode:
yw
y is for yank and w is for word.
Other ways of doing the same thing which are not as efficient:
vey
the v starts visual select mode. e tells vim to move to end of word. y yanks or copies the word. to delete replace y with x.
@tobiasahlin
tobiasahlin / transitions.scss
Created August 6, 2014 12:43
Sass multiple transitions mixin
// Usage: @include transition(width, height 0.3s ease-in-out);
// Output: -webkit-transition(width 0.2s, height 0.3s ease-in-out);
// transition(width 0.2s, height 0.3s ease-in-out);
//
// Pass in any number of transitions
@mixin transition($transitions...) {
$unfoldedTransitions: ();
@each $transition in $transitions {
$unfoldedTransitions: append($unfoldedTransitions, unfoldTransition($transition), comma);
}
@ryin
ryin / tmux_local_install.sh
Last active February 29, 2024 08:34
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active March 31, 2024 11:57
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 20, 2024 04:15
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example