This file contains hidden or 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 __future__ import print_function, division | |
| import re | |
| import string | |
| from collections import Counter | |
| with open('/usr/share/dict/words', 'r') as f: | |
| DICTIONARY = set(w.lower() for w in f.read().split()) |
This file contains hidden or 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 | |
| import eventlet | |
| from flask import Flask, render_template, request | |
| from flask_socketio import SocketIO, emit, send, join_room, leave_room | |
| app = Flask(__name__) | |
| socketio = SocketIO(app) |
This file contains hidden or 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
| # wget these files first by running: | |
| # $ wget -i fitsfiles | |
| http://spacewarps.org/subjects/raw/CFHTLS_074_2382_g.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_074_2382_i.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_074_2382_r.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_074_2382_u.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_074_2382_z.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_077_1278_g.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_077_1278_i.fits.fz | |
| http://spacewarps.org/subjects/raw/CFHTLS_077_1278_r.fits.fz |
This file contains hidden or 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 django.conf.urls import patterns, include, url | |
| from django.contrib import admin | |
| admin.autodiscover() | |
| urlpatterns = patterns('', | |
| url(r'^$', 'portal.views.home', name='home'), | |
| url(r'^start', 'portal.views.start', name='authentication'), | |
| url(r'^login', 'portal.views.login', name='login'), | |
| url(r'^logout', 'portal.views.logout', name='logout'), |
This file contains hidden or 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 fabric.api import cd, run | |
| def deploy(directory): | |
| """Deploys the code onto the given host by doing a `git pull`. | |
| Deploy the code by installing fabric (pip install fabric) and running the | |
| following command: | |
| $ fab -H user@hostname deploy:directory=/var/www/myproject/ |
This file contains hidden or 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
| <?php | |
| function pre_render_pdf($mpdf, $form_id, $lead_id, $arguments, $output, $filename) { | |
| // XXX: We have multiple notifications setup which means this function is | |
| // called multiple times and we end up appending the document many times. This | |
| // will help us get around that by ensuring it's only called once. | |
| static $has_been_called = false; | |
| if($has_been_called) return $mpdf; | |
| // XXX: We're only interested in the form with ID=1 |
This file contains hidden or 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
| #!/usr/bin/env php | |
| <?php | |
| /** | |
| * A simple static site generator useful for prototyping. | |
| * | |
| * Example: | |
| * | |
| * layout.php | |
| * | |
| * <body><?php require($page); ?></body> |
This file contains hidden or 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> | |
| <style> | |
| .chart { | |
| background-color: #202020; | |
| } | |
| .chart rect { | |
| shape-rendering: crispEdges; | |
| stroke: none; |
This file contains hidden or 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
| .gform_wrapper table.gfield_list thead th { | |
| font-weight: normal; | |
| text-transform: none; | |
| } | |
| input, textarea { | |
| margin-bottom: 0; | |
| } | |
| .gform_wrapper .top_label .gfield_label { | |
| margin-top: 20px !important; | |
| text-transform: uppercase; |
This file contains hidden or 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($) { | |
| $('#gform_1').change(function(e) { | |
| try { | |
| localStorage.setItem('gform_1', JSON.stringify($(this).serializeArray())); | |
| } catch (e) { | |
| console.error('Local storage quota exceeded.'); | |
| } | |
| }); |