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
'use strict'; | |
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
function flingPoo(){ | |
res.write("💩"); | |
setTimeout(flingPoo, 1000); | |
} | |
flingPoo(); |
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 generate_csr(domain): | |
import tempfile | |
import shutil | |
from sh import openssl | |
csr_data = "/C=%s/ST=%s/L=%s/O=%s/CN=www.%s" % ( | |
domain.country.upper(), | |
domain.full_state, | |
domain.city, | |
domain.letterhead_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
class MyBaseViewSet(viewsets.ModelViewSet): | |
def get_nested_serializer_class(self, serializer_class, related_name): | |
lookup_key = (serializer_class, related_name) | |
return serializers.NESTED_SERIALIZER_FIELD_MAP[lookup_key] | |
def get_serializer(self, *args, **kwargs): | |
serializer = super(MyBaseViewSet, self).get_serializer(*args, **kwargs) | |
context = self.get_serializer_context() | |
embed_str = context['request'].QUERY_PARAMS.get('embed', '') | |
if not embed_str: |
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 partially_nested(serializer, include_fields=None, exclude_fields=None): | |
partial_fields = set(include_fields or []) - set(exclude_fields or []) | |
serializer.opts.exclude = tuple( | |
set(serializer.get_fields()) - set(partial_fields) | |
) | |
serializer.fields = serializer.get_fields() | |
return serializer | |
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 subprocess | |
def create_libtiff_tool(command_name): | |
try: | |
help_str = subprocess.check_output( | |
command_name, | |
stderr=subprocess.STDOUT | |
) | |
except subprocess.CalledProcessError, e: | |
help_str = e.output |
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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
/*background: linear-gradient(45deg, #f06, yellow);*/ | |
min-height:100%; | |
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
don@box:~/Development/node/node/out/Release $ curl http://npmjs.org/install.sh | sh | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 5100 100 5100 0 0 13892 0 --:--:-- --:--:-- --:--:-- 96226 | |
fetching: http://registry.npmjs.org/npm/-/npm-1.0.30.tgz | |
0.5.5 | |
1.0.30 | |
cleanup prefix=/Users/don/Development/node/node/out | |
find: /Users/don/Development/node/node/out/share/man: No such file or directory | |
find: /Users/don/Development/node/node/out/share/man: No such file or directory |