An example of how to make a multi-sort React table with ImmutableJS and Styled Components, using ImmutableJS Records.
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 os | |
import hashlib | |
def get_git_object_hash(filepath): | |
""" | |
If you use git hash-object <file>, it will give you git's | |
internal hash for that object: http://stackoverflow.com/a/552725/78202 | |
This method provides a way to get a git-compatible hash of the file | |
at path `filepath`. | |
""" |
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 tarhash(tarpath, hash='sha1'): | |
""" | |
given a path to a tar file, return a checksum of its | |
summed / concatenated contents. | |
tarpath - a tar.gz path string to open | |
hash - one of the hash methods supported by hashlib | |
""" | |
total_hash = hashlib.new(hash) | |
with open(tarpath, 'rb') as input_file: |
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
var AWS = require('aws-sdk'); | |
var path = require('path'); | |
var https = require('https'); | |
/** | |
* This assumes that messages are added to DynamoDB | |
* with parameters `name` and `message`. | |
* | |
* To get this to work with your slack channel, you | |
* first need to configure Incoming Webhook for your |
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
#!/usr/bin/env bash | |
# after running this command, the list of management commands will be in | |
# `sorted_management_commands.txt`, which you can `cat` out. | |
rm -f management_commands.txt | |
touch management_commands.txt | |
for i in **/management/commands/*.py | |
do echo "$(git log -1 --format='%ad | %C(green)%ae%Creset |' --date=short -- $i) $i" >> management_commands.txt | |
done | |
cat management_commands.txt | sort >! sorted_management_commands.txt |
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 | |
import ctypes | |
import gc | |
import inspect | |
from collections import defaultdict | |
import re | |
from blinker import NamedSignal | |
from django.core.management.base import BaseCommand |
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 bs4 import BeautifulSoup | |
def get_text_from_html(html_str): | |
""" | |
Given a string of html, return the text content, | |
removing HTML contents and style artifacts. | |
This function solves an issue that when pasting from Word, | |
<style> tags can contain html comments that bsoup 4 | |
doesn't skip over when calling get_text(). |
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 ParentClass(object): | |
__special = '' | |
def __init__(self, *args, **kwargs): | |
self.__class__.__special = 'ParentClass' | |
self.__special = 'ParentClass' | |
print self.__dict__ | |
def special(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
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
# that enables you to choose a character from a menu of options. If you are on Lion | |
# try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
# for input. | |
# | |
# It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
# it's a nightmare to deal with in Atom if you're running vim mode, | |
# as it means you cannot press and hold h/j/k/l to move through your file. You have | |
# to repeatedly press the keys to navigate. |
This script generates a Markdown-formatted link to the most recent Git commit in a repository, including the commit’s date/time, short SHA, and message. It’s designed for use as a Git alias but can also be run standalone.
- Converts SSH repository URLs to HTTPS automatically.
- Outputs a link in the format:
YYYY-MM-DD HH:MM - shortSHA - commit message #git/commit
OlderNewer