json api server using grace
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 ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"regexp" | |
"strings" | |
) |
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 sys | |
def patch_json(): | |
try: | |
import __pypy__ | |
except ImportError: | |
pass | |
else: | |
import json | |
sys.modules['ujson'] = json |
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 absolute_import, unicode_literals | |
import gevent | |
from django.db import models | |
from django.utils.functional import cached_property | |
class AppUser(models.Model): | |
id = models.CharField(max_length=100, primary_key=True) | |
name = models.CharField(max_length=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
class Smaple(models.Model): | |
var_id = models.IntegerField() | |
@cached_property | |
def var(self): | |
return Var.get(self.var_id) | |
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 count = 0 | |
for scene in scenes { | |
if scene.hasPrefix("Act 1") { | |
count += 1 | |
} | |
} | |
count = scenes.filter({$0.hasPrefix("Act 1")}).count |
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
source 'https://rubygems.org' | |
gem 'chef' | |
gem 'knife-solo' |
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 boto import ses | |
from django.conf import settings | |
class EMail(object): | |
def __init__(self): | |
self._connection = ses.connect_to_region( |
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 go | |
import ( | |
"io/ioutil" | |
"github.com/gonuts/yaml" | |
) | |
var Config = make(map[string]interface{}) | |
func Load(yamlFile string) (err error) { |
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
<!doctype html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script> | |
<script type="text/javascript"> | |
function tableController($http, $scope) { | |
$scope.records = [ | |
{ | |
id: 1, | |
name: 'John', |
OlderNewer