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 glob | |
import re | |
# Regex to find all the links defined in LaTeX | |
regex = re.compile(r'\\link{.*}', re.IGNORECASE) | |
def strip_http_things(link): | |
"""Used to clean links for better sorting and for 'cleaner' | |
final display: |
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 -*- | |
from __future__ import unicode_literals | |
import codecs | |
import json | |
from jinja2 import Template | |
import requests | |
# online |
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
$ (awesomenv) pip install docopt | |
Downloading/unpacking docopt | |
Downloading docopt-0.6.1.tar.gz | |
Running setup.py egg_info for package docopt | |
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] | |
or: -c --help [cmd1 cmd2 ...] | |
or: -c --help-commands | |
or: -c cmd --help | |
error: invalid command 'egg_info' |
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 functools | |
# Broken implementation | |
class ClassDecoratorOptionalArguments(object): #rename | |
def __init__(self, value=None): | |
# set the 'value' argument as an attribute | |
self.value = value |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
var p = fmt.Println | |
p("I don't want to type fmt.Println.") |
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 djwebhooks.decorators import hook | |
from django_rq import job | |
# This assumes the project update was committed by user 'audreyr' | |
@job | |
@hook(event="project.update") | |
def send_project_update(project, owner, identifier): | |
""" The following help in identifying the webhook | |
:event: i.e. GitHub commit.push. Not unique! |
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 djwebhooks.decorators import hook | |
# This assumes the project update was committed by user 'audreyr' | |
@hook(event="project.update") | |
def send_project_update(project, owner, identifier): | |
""" The following help in identifying the webhook | |
:event: i.e. GitHub commit.push. Not unique! | |
:owner: Who created a webhook. I.E. pydanny | |
:identifier: A owner or system defined key. Unique amongst pydanny's webhooks' |
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 webhooks import webhook | |
>>> from webhooks.senders import targeted | |
>>> @webhook(sender_callable=targeted.sender) | |
>>> def basic(url, wife, husband): | |
>>> return {"husband": husband, "wife": wife} | |
>>> r = basic(url="http://httpbin.org/post", husband="Danny", wife="Audrey") | |
>>> import pprint | |
>>> pprint.pprint(r) |
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 python | |
#-*- coding: utf-8 -*- | |
""" | |
For Python 2.7 | |
Prince's comments: | |
To be able to access systems through Facebook, I just want the code to be able to recieve the three cookies e.g |
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 swap(a, x, y): | |
"""Swap two position values in a list""" | |
a[x],a[y] = a[y], a[x] |
OlderNewer