Skip to content

Instantly share code, notes, and snippets.

View MuYunyun's full-sized avatar
🐢
Working and Learning

MuYunyun

🐢
Working and Learning
  • Shanghai, China
View GitHub Profile
@gre
gre / easing.js
Last active June 13, 2024 12:18
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@zhugexiaobo
zhugexiaobo / updateRepo.sh
Created August 29, 2013 10:30
批量 git pull 仓库最新代码
#!/bin/sh
for dir in $(ls -d */)
do
if [ -d "$dir"/.git ]; then
echo "$dir" && cd "$dir" && git pull && cd ..
fi
done
@melkorm
melkorm / post-receive.md
Last active July 2, 2020 11:19
GIT: Pre receive hook to prevent pushing unresolved conflicts
#!/usr/bin/env bash
read old_sha new_sha refname

# if we delete branch don't do anything
if [[ "$new_sha" =~ ^0+$ ]]; then
   exit 0
fi

# if we push new branch we need to set correct old_sha
@kevincennis
kevincennis / v8.md
Last active June 18, 2024 07:21
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@donnut
donnut / currying.md
Last active October 28, 2023 17:58
TypeScript and currying

TypeScript and currying

In functional programming you often want to apply a function partly. A simple example is a function add. It would be nice if we could use add like:

var res2 = add(1, 3); // => 4

var add10To = add(10);
var res = add10To(5); // => 15
@lgarron
lgarron / copyToClipboard.html
Last active December 20, 2023 12:53
Simple `navigator.clipboard.writeText()` polyfill.
<script>
// A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers.
// Note that:
// - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020.
// - In Edge, this may call `resolve()` even if copying failed.
// - In Safari, this may fail if there is nothing selected on the page.
// See https://github.com/lgarron/clipboard-polyfill for a more robust solution.
//
// License for this Gist: public domain / Unlicense
function writeText(str) {
@maxmarkus
maxmarkus / pre-commit-hook-merge-conflicts.sh
Created March 24, 2016 13:26
Git pre-commit hook to prevent checking in non-resolved merge conflicts.
#!/bin/bash
# Check for merge conflicts
# Tested on Linux and Mac
# Simple check for merge conflics
conflicts=`git diff --cached --name-only -G"<<<<<|=====|>>>>>"`
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@Saul-Mirone
Saul-Mirone / mini-express.js
Last active November 15, 2019 12:36
Just An Express Style Framework
const http = require('http')
const url = require('url')
const path = require('path')
const fs = require('fs')
const mime = {
"html": "text/html",
"css": "text/css",
"js": "text/javascript",
"json": "application/json",
"gif": "image/gif",
@mattmccarty
mattmccarty / git-log-beautifier
Created March 20, 2017 21:20
Beautify the output of git-log
# Issue the command below:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# When you want to beautify the git log, use the following command:
git lg
# Reference:
https://coderwall.com/p/euwpig/a-better-git-log