A Pen by Devvyn Murphy on CodePen.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# readable, but not DRY | |
def fb1(number): | |
return ''.join(( | |
('fizz' if (not number % 3) else ''), | |
('buzz' if (not number % 4) else ''))) or str(number) | |
# fully DRY, easy to maintain | |
def fb2(number): | |
a = {3: 'fizz', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<root> | |
<item> | |
<!-- a brief discussion about this config was originally posted here https://groups.google.com/d/topic/osx-karabiner/4TdHyfImc-k I lifted it and changed the Name --> | |
<name>Matias Style One-handed Half-QWERTY</name> | |
<identifier>Half-QWERTY</identifier> | |
<autogen> | |
__HoldingKeyToKey__, KeyCode::SPACE, KeyCode::SPACE, KeyCode::VK_NONE, KeyCode::VK_CONFIG_SYNC_KEYDOWNUP_notsave_flip_hands | |
</autogen> | |
</item> |
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 | |
commands=(cow{say,think}); while [ "rainbows are delightful" ]; do (fortune | ${commands[$RANDOM % ${#commands[@]}]} -f $(cowsay -l | tail -n+2 | xargs -n 1 | sort -R | head -n 1) | lolcat -a ) && sleep 2; done |
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
from CsvFileModel import CsvFileModel # available from https://gist.github.com/devvyn/759f08e3d83e4cf8f7ef | |
import json | |
import yaml | |
import collections | |
class StringTree(object): | |
def __init__(self): | |
c = CsvFileModel('csp.csv') | |
skus = list(x.strip() for x in c['OTV SKU#']) |
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
# coding=utf-8 | |
""" | |
Convenience wrapper for csv.DictReader showing use of __getattr__ to do magic lookups on the loaded file. | |
To procedurally implement CsvFileModel, without a new class, pass the target package_name and/or filename to the constructor. | |
For example: | |
my_spending_report = CsvFileModel(filename='spendnov1995.tsv', package_name='my_project.data') | |
my_spending_report = CsvFileModel(filename='spendnov1995.tsv') |