Search and replace ' with " from the current cursor postion to the end of the file.
:,$s/'/"/gc
#!/usr/bin/env bash | |
STACK_NAME=$1 | |
if [ -z "$1" ] | |
then | |
echo "No STACK_NAME argument supplied" | |
exit 1 | |
fi |
import boto3 | |
s3_client = boto3.client('s3') | |
def list_dirs(bucket, prefix): | |
""" Yield direct child folders of the given prefix. | |
""" |
import yaml | |
import json | |
import pandas as pd | |
df = pd.DataFrame({'one': [1.0, 2.1, 3.2], 'two': [4.3, 5.4, 6.5]}) | |
with open('df.yml', 'w') as file: | |
yaml.dump({'result': json.loads(df.to_json(orient='records'))}, file, default_flow_style=False) |
#!/usr/bin/env bash | |
STACK_NAME=$1 | |
STACK_PATH=$2 | |
if [ -z "$1" ] | |
then | |
echo "No STACK_NAME argument supplied" | |
exit 1 | |
fi |
(defun toss () | |
(/ (* (/ (/ (* complexity operating-cost) | |
work-to-turn-off) | |
1000.0) | |
(+ security-risk accountability-risk)) | |
(* (/ active-users total-possible-users) | |
(* total-possible-users future-growth)))) | |
;; CLUES 1.0 | |
(let ((complexity 3.0) |
bindkey -v | |
bindkey "^R" history-incremental-search-backward | |
# zle vi mode indication | |
# http://pawelgoscicki.com/archives/2012/09/vi-mode-indicator-in-zsh-prompt/ | |
setopt PROMPT_SUBST | |
vim_ins_mode="-- INSERT --" | |
vim_cmd_mode="" | |
vim_mode=$vim_ins_mode |
If you've done much reading about angularjs you've no doubt come across mention of karma, a test runner recommended especially for use with angularjs applications. The [angular-seed][1] project is a great way to get started with the basics of angular testing using karma, but for projects of any significant size you will soon hit the cieling in terms of organizational complexity. What I want to share in this article is the approach I have taken using [Grunt][2] and the [grunt-karma][3] plugin to sustainably manage my projects' client side unit tests and run them via [TravisCI][4]. I plan to write another entry about how to approach the actual minutia of unit testing angular code in the near future.
Karma is really nothing more than a set of centralized configuration that builds a test runner for you. The advantage being that it allows you to easily execute tests in a headless browser, and output to the command line. As someone who has actually set all of that up from scratc
In my last blog on this topic, I claimed that the choice to use RequireJS handcuffed you to the less than awesome experience of using a browser based test runner. I was wrong! Surprised? Yeah, me neither.
I describe my ideal testing experience to be this: Anytime something changes, my personal robot army runs unit tests and tells me what I broke without me having to lift a god damned finger. I'm a programmer, I'm lazy, that's why I do this; so I can automate my life, my code, my income, and just retire to an island while my robots run shit. I'm not quite there yet, but this is here to share with you, how I finally figured out step 1337 of this plan - Automated Javascript Unit Testing.
In this post, I'm not planning to go deep into how to write unit tests, mock, spy, or any of that. This is going to be about where and how the tests are run, not how to write them. If you're just getting started with testing your RequireJS modules, check out [amd-testing][1] and [RequireJS + Chai + Moc
import argparse | |
import base64 | |
import os | |
import zlib | |
from pathlib import Path | |
def convert(s): | |
b = base64.b64decode(s.encode('ascii')) | |
return zlib.decompress(b).decode('utf-8') |