Skip to content

Instantly share code, notes, and snippets.

View lexjacobs's full-sized avatar

Alex Jacobs lexjacobs

View GitHub Profile
@lexjacobs
lexjacobs / rainbow_name.sh
Created December 14, 2018 03:20
accepts stdin or asks for input
if [ -z $1 ]
then
echo 'What is your name?'
read name
output=$name
else
output=$1
fi
cowsay $output | lolcat
@lexjacobs
lexjacobs / init.coffee
Created July 5, 2017 21:53
atom init script
atom.commands.dispatch(atom.views.getView(atom.workspace), 'voicecode:connect')
# enables "shift-space" to move through closing matched brackets
SymbolRegex = /\s*[(){}<>[\]/'"]/
atom.commands.add 'atom-text-editor', 'custom:jump-over-symbol': (event) ->
editor = atom.workspace.getActiveTextEditor()
cursorMoved = false
for cursor in editor.getCursors()
range = cursor.getCurrentWordBufferRange(wordRegex: SymbolRegex)
unless range.isEmpty()
@lexjacobs
lexjacobs / keymap.cson
Last active February 27, 2018 03:46
atom keymap
'atom-text-editor':
'cmd-c': 'editor:copy-selection'
'atom-text-editor:not([mini])':
'shift-space': 'custom:jump-over-symbol'
# emmet and language-babel package setting
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
@lexjacobs
lexjacobs / asycncQueues.js
Last active July 5, 2017 19:28
async queuing system that will retry failures
// 50% success rate for each task
function unstableTask() {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (Math.random() < 0.5) {
resolve('task succeeded!');
} else {
reject('task failed!')
}
@lexjacobs
lexjacobs / styles.less
Last active July 5, 2017 21:52
atom styles
// change the color of the file line numbers
atom-text-editor.editor .line-number {
color: rgb(50, 255, 50);
}
// lighten up the color of the selected file
.list-group .selected::before,
.list-tree .selected::before {
background-color: #555;