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 | |
# friday.hirelofty.com | |
on="1" | |
if [ $1 -eq $on ] | |
then | |
echo "Removing desktop icons and restarting finder" | |
defaults write com.apple.finder CreateDesktop false | |
killall Finder |
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 json | |
import markovify | |
import re | |
import time | |
from slackclient import SlackClient | |
BOT_TOKEN = "bot user API token" | |
GROUP_TOKEN = "slack user API token" |
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 json | |
import markovify | |
import re | |
import time | |
from slackclient import SlackClient | |
BOT_TOKEN = "insert bot token here" |
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 markovify | |
import time | |
from slackclient import SlackClient | |
BOT_TOKEN = "insert bot token here" | |
GROUP_TOKEN = "insert slack group token here" | |
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
class ETLRegistry(object): | |
""" | |
The ETL registry stores the relationships between Extract, Transform | |
and Load classes. | |
An entry tracks both a string representation (for passing through message queue) and | |
a reference for the class (for invocation inside the task) | |
""" | |
_regsitry = [] |
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 functools import wraps | |
from django.conf import settings | |
from django.http import HttpResponseRedirect | |
def require_ssl(view): | |
""" | |
Decorator that requires an SSL connection. If the current connection is not SSL, we redirect to the SSL version of | |
the page. |
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
STATUS_CANCELLED = 'cancelled' | |
STATUS_NEW = 'new' | |
STATUS_PENDING = 'pending' | |
STATUS_PAYMENT_DUE = 'payment-due' | |
STATUS_PAYMENT_PENDING = 'payment-pending' | |
STATUS_PAID = 'paid' | |
NEGOTIABLE_STATUS_CHOICES = ( | |
(STATUS_CANCELLED, 'Cancelled'), # Cancelled, duh | |
(STATUS_NEW, 'New'), # Default state of request |
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
if self.request.POST.get('action').lower().find('book') > -1: | |
# if everything on the other side was all set to go and the user making changes, | |
# the button they are pushing contains "book" on it and we can redirect to booking this session. | |
return HttpResponseRedirect(reverse('setup_payment_for_session', kwargs={'pk': obj.pk})) |
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
@property | |
def request(self): | |
""" | |
just for convenience | |
""" | |
return self |
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
class DashboardManageUsersFormset(BaseFormSet): | |
def __init__(self, *args, **kwargs): | |
self.assignment_perms = kwargs.pop('assignment_perms', None) | |
super(DashboardManageUsersFormset, self).__init__(*args, **kwargs) | |
def _construct_forms(self): | |
self.forms = [] | |
for i in xrange(self.total_form_count()): | |
self.forms.append(self._construct_form(i, assignment_perms=self.assignment_perms)) |
NewerOlder