function drawLine(length = 0) {
// We don't need to do anything in the loop itself. This is honestly a little
// too "clever" but it works to build a string of #s.
for(var line = ''; line.length < length; line += '#') {
}
// Bonus part:
// This checks if the number of #s will be even or not.
// It's called the "modulo operator". Think of it as "the remainder of
This file contains hidden or 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
#NoEnv | |
; Recommended for performance and compatibility with future AutoHotkey releases. | |
; Needs to be the absolute first thing. | |
; Enable warnings to assist with detecting common errors. | |
; #Warn | |
; Recommended for new scripts due to its superior speed and reliability. | |
SendMode Input |
If your vim distribution uses vim-plug
and includes plugins you don't want, or if you want to simply maintain a single set of plugins but disable some on certain machines, this may be for you.
let g:plugs_disabled = []
function! plug_disable#commit()
for name in g:plugs_disabled
docker_machine_create_vmwarefusion () {
name="${1:-test}"
dir="${HOME}/.docker/machine/machines/${name}"
vmx="${dir}/${name}.vmx"
vmrun="/Applications/VMware Fusion.app/Contents/Library/vmrun"
# Something about the initial run of docker-machine+vmwarefusion needs sudo
sudo $(which docker-machine) -D create -d vmwarefusion "${name}"
This file contains hidden or 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
components = {} | |
addOne = (name, component) -> | |
components[name] = component | |
return | |
addMany = (obj) -> | |
addOne name, component for own name, component of obj |
This is really just a shorthand for:
- Creating an Angular controller using standard object notation.
- Less repetition, but full support, of dependencies.
- Support either
Controller as resource
, or passing it off to a separate view. - Creating States for ui-route, with all of the above.
What I like about this combined with ui-route is the pattern for resources:
This file contains hidden or 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/sh | |
# Inspired by user rlively | |
# http://forums.plexapp.com/index.php/user/82346-rlively/ | |
while true; do | |
clear | |
curl -s http://127.0.0.1:32400/video/ssp/downloads | grep options-for-current | sed -n 's/.*title="\([^"]*\).*/\1/p' | |
sleep 2 | |
done |