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 tornado import ioloop | |
from tornado import iostream | |
import socket | |
class Envelope(object): | |
def __init__(self, sender, rcpt, body, callback): | |
self.sender = sender | |
self.rcpt = rcpt[:] | |
self.body = body | |
self.callback = callback |
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
<!-- | |
Looking for some code reviews and commentary on this backbonejs application. | |
--> | |
<div class="content"> | |
<table class="portfolio"> | |
<thead> | |
<tr><th></th><th>Symbol</th><th>Name</th><th>Shares</th><th>% of portfolio value</th></tr> | |
</thead> |
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 trie(object): | |
MAX_SUGGEST = 10 | |
__slots__ = ('children', 'freq', 'name', '_top') | |
def __init__(self): | |
self.children = defaultdict(trie) | |
self.freq = 0 | |
self.name = None | |
self._top = None |
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
(function(_, Backbone) { | |
var defaultFilter = function() {return true;}; | |
/** | |
* This represents a filtered collection. You can either pass a filter or | |
* invoke setFilter(filter) to give a filter. The filter is identical to | |
* that which is used for _.select(array, filter) | |
* | |
* false filter indicates no filtering. | |
* |
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
(function (E, B) { | |
function ka(a, b, d) { | |
if (d === B && a.nodeType === 1) { | |
d = a.getAttribute("data-" + b); | |
if (typeof d === "string") { | |
try { | |
d = d === "true" ? true : d === "false" ? false : d === "null" ? null : !c.isNaN(d) ? parseFloat(d) : Ja.test(d) ? c.parseJSON(d) : d | |
} catch (e) {} | |
c.data(a, b, d) | |
} else d = B |
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
#include <unistd.h> | |
#include <fcntl.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <ev++.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#include <resolv.h> | |
#include <errno.h> | |
#include <list> |
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 logging | |
from addons.route import route | |
from .base import BaseHandler | |
from amazonproduct.api import API, NoExactMatchesFound, TooManyRequests | |
from tornado import httpclient | |
from tornado.web import asynchronous, HTTPError | |
from tornado import gen | |
from app.util.cache import LRUCache | |
from StringIO import StringIO |
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
{ | |
"Description": "EC2 OpenVPN host for stage-railz", | |
"Mappings": { | |
"AmiMap": { | |
"us-east-1": { | |
"bastion": "ami-2757f631", | |
"ecs": "ami-b2df2ca4", | |
"ubuntu1604": "ami-2757f631" | |
}, | |
"us-west-2": { |
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
// UpdateUser save user updates to the DB | |
func (svc *userService) UpdateUser(ctx context.Context, user *model.User, args UpdateUserInput) (*model.User, error) { | |
update := make(map[string]interface{}) | |
if args.Password != nil { | |
user.HashPassword(*args.Password) | |
update["password"] = user.Password | |
} | |
if args.Name != nil && *args.Name != user.Name { | |
update["name"] = *args.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
package nresolver | |
import ( | |
"reflect" | |
"strings" | |
"github.com/asaskevich/govalidator" | |
"github.com/graphql-go/graphql" | |
"github.com/mitchellh/mapstructure" | |
) |
OlderNewer