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
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 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
function SecretHuman (name) { | |
this.getName = function () { | |
return name | |
} | |
} | |
var person = new SecretHuman("Chloe") | |
console.log("My name is " + person.getName()) // => My name is Chloe |
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
# PUT THIS IN .git/hooks/pre-push IN YOUR PROJECT. | |
#!/bin/bash | |
protected_branch='master' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
push_command=$(ps -ocommand= -p $PPID) | |
if [ $current_branch = $protected_branch ] || [[ $push_command =~ $protected_branch ]] | |
then | |
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/mark/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="avit" |
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 fs = require('fs') | |
function replaceInFile ({ file, pattern, replacement }) { | |
fs.readFile(file, 'utf8', (err, data) => { | |
if (err) { | |
return console.log(err) | |
} | |
const result = data.replace(pattern, replacement) |
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
module RakeUtils | |
class << self | |
# Load the rakefile, unless it's already been loaded. | |
def load_rakefile | |
@load_rakefile ||= begin | |
load "#{PROJECT_ROOT_PATH}/Rakefile" | |
true |
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
{"lastUpload":"2020-09-14T17:18:10.569Z","extensionVersion":"v3.4.3"} |
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
// Default use: | |
const [selectedMedias, addId, removeId] = useSelectedItems(medias) | |
// Example of how to select an item | |
map(medias, ({ id, title }) => <a onClick={() => addId(id)}>{ id } { title }</a>) | |
// Example of how to deselect an item | |
map(selectedMedias, ({ id, title }) => <a onClick={() => removeId(id)}>{ id } { title } is selected!</a>) | |
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
export const handler: Handler = compose( | |
httpRespond(), | |
httpMethod('POST'), | |
)(async ({ body }: APIGatewayEvent) => ({ | |
post: await createPost(JSON.parse(body)) | |
})) | |
/* | |
Recently wrote some Next.js/Netlify functions to run in AWS Lambdas. |