Skip to content

Instantly share code, notes, and snippets.

Daniel Garfield dbgarf

Block or report user

Report or block dbgarf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:238f4d8aa4669808f2c10330443ff541
/usr/bin/ruby -e "$(curl -fsSL"
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
View gist:c29ae7d7a3bebc4887986c3f631f0948
$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 }
View gist:f885ddbd5b9d6134f9ae318ae9158459
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 = []
View gist:0974b637115faca9dd6877d1fb5cceab
name = Dan Garfield
email =
co = checkout
s = status
a = add
d = difftool
c = commit
View gist:10214ba5fb7e61688f4a
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)
# 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
You can’t perform that action at this time.