This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.githubusercontent.com/devxoul/72adcb880b273a36420d/raw/git-pruneoff | |
# Delete merged branches. | |
git branch --merged | awk '{if($1 != "*" && ($1 != "master" || $1 != "main")) print $1}' | xargs git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getFileFromURL = async (url: string): Promise<File> => { | |
const result = await fetch(url) | |
const buffer = await result.arrayBuffer() | |
const blob = new Blob([buffer]) | |
const file = new File([blob], url.split('/')[1]) | |
return file | |
} | |
// Usage | |
const someFile: File |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js | |
+ ../MyApp/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_getFileData(file) { | |
const relativePath = fastPath.relative(this._rootDir, file); | |
+ if (file.endsWith('node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js')) { | |
+ console.log('rootDir:', this._rootDir); | |
+ console.log('file:', file); | |
+ console.log('relativePath:', relativePath); | |
+ } | |
return this._files.get(relativePath); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example Usage | |
func openLocation() { | |
guard let workspaceClass = NSClassFromString("LSApplicationWorkspace") else { return } | |
let workspace: AnyObject = execute(workspaceClass, "defaultWorkspace") | |
let url = URL(string: "Prefs:root=Privacy&path=LOCATION")! | |
execute(workspace, "openSensitiveURL:withOptions:", with: url) | |
} | |
private func getImplementation(_ owner: AnyObject, _ name: String) -> IMP { | |
let selector = Selector(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/devxoul/00b5b4fac4243075656dc79912e256d6 | |
git rebase --exec 'git commit --amend -C HEAD --date="$(date -R)" && sleep 1.05' $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.mock('@wry/equality', () => ({ | |
equal: (lhs: any, rhs: any) => { | |
const equals = require('expect/build/jasmineUtils').equals(lhs, rhs) | |
return equals || jest.requireActual('@wry/equality').equal(lhs, rhs) | |
} | |
})) | |
const mocks = [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Spy<T extends {}, M extends jest.FunctionPropertyNames<Required<T>>> = Required<T>[M] extends (...args: any[]) => any | |
? jest.SpyInstance<ReturnType<Required<T>[M]>, jest.ArgsType<Required<T>[M]>> | |
: never; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filteredPokemonsByIV(pokemons, iv) { | |
iv = iv || 0.9; | |
return pokemons.filter(function (pokemon) { | |
var currentIV = (pokemon.attack + pokemon.defence + pokemon.stamina) / 45; | |
return currentIV >= iv; | |
}); | |
} | |
function arePokemonsEqual(lhs, rhs) { | |
if (lhs.length != rhs.length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.githubusercontent.com/devxoul/a972ba0db2a25b989887/raw/f62353501becb274eb63c76b83fbcc01250a286d/git-pushme | |
# git push origin CURRENT_BRANCH | |
BRANCH=$(git branch --list | awk '{ if ($1 == "*") print $2 }') | |
while true; do | |
read -p "Push branch '$BRANCH' to origin? [Y/n] " -n 1 -r | |
echo |