- option+shift+drag
- alt+click
- cmd+opt+arrow up/down
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
require 'octokit' | |
client = Octokit::Client.new access_token: ENV['MY_GITHUB_PERSONAL_TOKEN'] | |
client.auto_paginate = true | |
repo = 'ORG_NAME/REPO_NAME' | |
issues = client.issues repo | |
puts "Repo #{repo} has #{issues.length} issues." |
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
#!/usr/bin/env ruby | |
puts File.read $0 # This is cheating, I know |
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
pico-8 cartridge // http://www.pico-8.com | |
version 16 | |
__lua__ | |
x=64 | |
y=64 | |
dir=nil | |
l=0 | |
r=1 | |
u=2 | |
d=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
.my-class { | |
@include single-line-truncate; | |
} |
Even better is probably to have a script.sh file which looks like this (same thing but more readable):
#!/bin/bash
sed "s/FNAME/Simone/g;\
s/LNAME/Vittori/g;\
s/EMAIL/myemail@foobar.com/g;"
Just chmod +x script.sh
and then use it like:
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 | |
# This program adds one or more labels to a GitHub issue/PR | |
username= | |
owner= | |
repo= | |
issue_or_pr_number= | |
curl -s https://api.github.com/repos/$owner/$repo/issues/$issue_or_pr_number/labels \ |
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
// Transforms an array into a sentence. | |
// Example: | |
// toSentence(['apples', 'oranges', 'melons']); | |
// >> "apples, oranges and melons." | |
export function toSentence(arr) { | |
if (arr.length === 0) return ''; | |
return arr.length > 1 | |
? `${arr.slice(0, arr.length - 1).join(', ')} and ${arr.slice(-1)}.` | |
: `${arr[0]}.`; |
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
// Converts 'foo-bar' to 'fooBar' | |
// Credits: https://stackoverflow.com/a/6661012 | |
export function camelize(str) { | |
return str.replace(/-([a-z])/g, g => g[1].toUpperCase()); | |
} | |
function camelizeKeys(obj) { | |
return Object.assign(...Object.entries(obj).map( | |
([key, val]) => ({ [camelize(key)]: val }) |
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
// Override console.error to run tests | |
const _console_error = console.error; | |
console.error = function (msg) { | |
if (/^Warning: Failed prop type:/.test(msg)) { | |
it('should pass PropType validation', () => { | |
throw new AssertionError(msg); | |
}); | |
} | |
// Call the real console.error | |
return _console_error.apply(console, arguments); |
NewerOlder