A Pen by Anonasaurus Rex on CodePen.
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 zmq | |
import sys | |
ctx = zmq.Context() | |
sock = ctx.socket(zmq.REQ) | |
sock.connect('tcp://localhost:3610') | |
for i in range(10): | |
print '%s -> ' % randMsg, | |
sys.stdout.flush() |
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
('input[type="text"]').typeahead | |
minLength: 3 | |
quietMillis: 250 | |
source: (query, process) -> | |
@options.map = {} | |
suggest = [] | |
self = @ | |
$.getJSON "api/users", {q: query}, (data) => | |
$.each data, (idx, item) -> | |
ele = "#{item.fullname} (#{item.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
#loader { | |
position: absolute; | |
background-repeat: no-repeat; | |
background-position: 50% 50%; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
background-color: rgba(255, 255, 255, 1); | |
z-index: 99; |
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 flask.ext.sqlalchemy import SQLAlchemy | |
from flask import Flask | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://db_user@localhost/employees' | |
db = SQLAlchemy(app) | |
class User(db.Model): |
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 pty | |
import os | |
import sys | |
commands = ["some-command", "--with", "options"] | |
pid, child_fd = pty.fork() | |
if not pid: | |
os.execv(commands[0], commands) | |
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 | |
from subprocess import PIPE, Popen | |
fd = open('/etc/fstab') | |
mounts = set([]) | |
for line in fd: | |
line = line.strip() | |
if line.startswith('#'): | |
continue | |
mnt_point = line.split() |
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
/** @jsx React.DOM */ | |
var STATES = [ | |
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', | |
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', | |
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', | |
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY' | |
] | |
var Example = React.createClass({ |
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> | |
<meta charset="utf-8"> | |
<title>DataTable Test</title> | |
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" media="screen" title="no title" charset="utf-8"> | |
</head> | |
<body> |
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 AttrStorage(dict): | |
def __init__(self, fields=None, **kwargs): | |
""" only keys defined in fields are allowed """ | |
self.fields = () | |
if fields: | |
self.fields = fields | |
super(AttrStorage, self).__init__(kwargs) | |
def __getitem__(self, name): |
OlderNewer