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/sh | |
# Redirect output to stderr. | |
exec 1>&2 | |
# enable user input | |
exec < /dev/tty | |
consoleregexp='^\+.*console\.log(' | |
# CHECK | |
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0 | |
then |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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 CORSResource(object): | |
""" | |
Adds CORS headers to resources that subclass this. | |
""" | |
def create_response(self, *args, **kwargs): | |
response = super(CORSResource, self).create_response(*args, **kwargs) | |
response['Access-Control-Allow-Origin'] = '*' | |
response['Access-Control-Allow-Headers'] = 'Content-Type' | |
return response |
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 tastypie import fields | |
from tastypie.authentication import Authentication | |
from tastypie.authorization import Authorization | |
from tastypie.bundle import Bundle | |
from tastypie.exceptions import NotFound | |
from tastypie.resources import Resource | |
# a dummy class representing a row of data | |
class Row(object): |
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 tastypie import fields | |
from tastypie.authentication import Authentication | |
from tastypie.authorization import Authorization | |
from tastypie.bundle import Bundle | |
from tastypie.exceptions import NotFound | |
from tastypie.resources import Resource | |
# a dummy class representing a row of data | |
class Row(object): |
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 tastypie.exceptions import NotFound | |
from tastypie.resources import ModelResource | |
from tastypie.authentication import BasicAuthentication, ApiKeyAuthentication | |
from tastypie.models import ApiKey | |
from django.contrib.auth.models import User | |
__author__ = 'martinsandstrom' | |
class ApiTokenResource(ModelResource): |
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
#sudo vim /Library/LaunchDaemons/io.redis.redis-server.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>io.redis.redis-server</string> | |
<key>ProgramArguments</key> | |
<array> |