- Make sure the image file you'd like to use is shared publicly.
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 | |
# installs virtualenvwrapper and adds initialization logic for .bashrc file | |
# change RC_FILE value as needed | |
RC_FILE=~/.bashrc | |
# global install of virtualenvwrapper | |
sudo pip install virtualenvwrapper | |
# creation of directory to store Python virtual environments |
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 -*- | |
""" | |
Calculates the following 'Developer Focus' metric using | |
data from the Pivotal Tracker API: | |
# unique developers actively working on active projects / | |
Open stories ("started" state) from active projects | |
For this first pass, the IDs of active projects and | |
developers are set as environment variables. | |
In the future, it may be possible to determine these |
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
# http://docs.python-requests.org/en/latest/ | |
import requests | |
from datetime import datetime, timedelta | |
domain_name = 'domain' | |
username = 'username' | |
password = 'password' | |
# lookup past 3 days along with today in case someone left a timer running | |
today = datetime.now() |
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 UserDetailAccessMixin(UserPassesTestMixin): | |
def test_func(self, user): | |
""" | |
Tests if user should be allowed access to DetailView if one of two conditions: | |
1. Has staff permissions | |
2. Is the customer associated with the object in a DetailView | |
""" | |
if user.is_staff: | |
return True | |
else: |
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
def get_selector(*args): | |
return ''.join([a for a in args]) | |
def get_parsley_errors_data(parsley_attr, fields): | |
parsley_extras = dict() | |
for field in fields: | |
field_dict = {} | |
field_slug = slugify(field) | |
field_dict[parsley_attr] = get_selector( |
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
/* Adapting base Parsley CSS into SASS mixins - http://parsleyjs.org/src/parsley.css */ | |
/* | |
Use this mixin to define success and error classes | |
Default class names: parsley-success, parsley-error | |
*/ | |
@mixin parsleyValidated($name, $textColor, $bgColor, $borderColor) { | |
input.#{$name}, | |
select.#{$name}, | |
textarea.#{$name} { |
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
<!-- | |
See http://codepen.io/lightstrike/pen/tswme for demo | |
Example markup and inspiration from http://jsfiddle.net/KyleMit/cyCFS/ | |
--> | |
<p>Full Size:</p> | |
<div class="left-inner-addon "> | |
<i class="glyphicon glyphicon-user"></i> | |
<input type="text" | |
class="form-control" |
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
""" | |
Usage: get_classes_from_html.py path/to/file.html | |
""" | |
def convert_html_to_string(html_file_path): | |
html_file = open(html_file_path, 'r') | |
return html_file.read() | |
def get_css_classes(html_string, attribute='class'): |