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
# re is the python regular expression module. its very powerful and worth learning. | |
import re | |
# unittest is the built in testing module. good for simple use cases like this. | |
from unittest import TestCase, TestLoader, TestResult | |
# compiling the regex pattern ahead of time, which adds significant speed | |
vowel_pattern = re.compile(r'[AEIOUaeiou]') | |
def is_vowel(char): | |
# raising errors for invalid input is a good idea |
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 django.views.generic import View | |
import json | |
class userView(View): | |
def get(self, request, user_id): | |
response_content = json.dumps({'message': 'user not updated'}) | |
return http.HttpResponse(response_content, status=200, mimetype='application/json') | |
def post(self, request, user_id): | |
user = User.objects.get(id=user_id) |
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
[user] | |
name = Dan Garfield | |
email = dbgarf@gmail.com | |
[alias] | |
co = checkout | |
s = status | |
a = add | |
d = difftool | |
c = commit |
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
import random | |
def bleed_multiplier(min_d, max_d, aps, chance, duration, trials=10000, ruthless=True, fossil=True, rys=True): | |
min_new = min_d | |
max_new = max_d | |
if rys: | |
min_new = int(0.7*min_d) | |
max_new = int(1.4*max_d) | |
totals = [] |
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
$total = 1440; | |
$totalW = 0 <# 52 #>; | |
$totalB = 0 <# 8 #>; | |
for ($i = 0; $i -lt 1440) { | |
if ($totalW -eq $totalB) { | |
$i += 52; $totalW += 1 | |
} | |
else { | |
$i += 8; $totalB += 1 } | |
}; |
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 | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew cask install google-chrome | |
brew cask install sublime-text | |
brew cask install hipchat | |
brew cask install 1password | |
brew cask install lastpass | |
brew cask install cyberduck |