Skip to content

Instantly share code, notes, and snippets.

View elidickinson's full-sized avatar

Eli Dickinson elidickinson

View GitHub Profile
@elidickinson
elidickinson / gist:1288059
Created October 14, 2011 19:23
form auto fill
javascript:var%20auto%20={names:%20'Steve%20Buscemi%20Catherine%20Keener%20Dermot%20Mulroney%20Danielle%20Zerneck%20James%20LeGros%20Rica%20Martens%20Peter%20Dinklage%20Kevin%20Corrigan%20Hilary%20Gilford%20Robert%20Wightman%20Tom%20Jarmusch%20Michael%20Griffiths%20Matthew%20Grace%20Ryan%20Bowker%20Francesca%20DiMauro',blurb:%20'phpBB%20is%20a%20free,%20open%20source%20Internet%20community%20application,%20with%20outstanding%20discussion%20forums%20and%20membership%20management.%20Written%20in%20the%20PHP%20scripting%20language,%20and%20making%20use%20of%20the%20popular%20MySQL%20database,%20phpBB%20is%20a%20standard%20among%20web%20hosting%20companies%20throughout%20the%20world,%20and%20is%20one%20of%20the%20most%20widely-used%20bulletin%20board%20packages%20in%20the%20world.%20phpBB%20short-circuits%20the%20need%20for%20you%20to%20be%20a%20web%20development%20master%20in%20order%20to%20create%20and%20manage%20massive%20online%20communities',password:%20'secret',fillerup:%20function()%20{var%20all_inputs%20=
@elidickinson
elidickinson / prettyprint.py
Created December 17, 2011 21:47
Pretty prints HTML file
import sys
from BeautifulSoup import BeautifulSoup as bs
soup=bs(open(sys.argv[1],'r').read())
print soup.prettify()
@elidickinson
elidickinson / libots.py
Created January 28, 2012 17:20
show how to access libots C library from Python
from ctypes import *
from ctypeslib.contrib.pythonhdr import *
def quick_summary(data,words=150):
ots = OTS()
ots.parse_string(data)
return ots.summarize_by_words(words)
class OTS:
libots = None
@elidickinson
elidickinson / media-queries.css
Created July 12, 2012 20:20
Tisa theme bugfix for single column 3.4.1
@media screen and (max-width: 980px) {
/************************************************************************************
STRUCTURE
*************************************************************************************/
.pagewidth {
max-width: 94%;
}
/* content */
@elidickinson
elidickinson / _gradients.css.scss
Created November 21, 2012 17:52 — forked from thbar/_gradients.css.scss
SCSS mixing for CSS3 gradients
@mixin gradient($from, $to) {
background-color: $from; /* fallback/image non-cover color */
background-image: -moz-linear-gradient($from, $to); /* Firefox 3.6+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to)); /* Safari 4+, Chrome 1+ */
background-image: -webkit-linear-gradient($from, $to); /* Safari 5.1+, Chrome 10+ */
background-image: -o-linear-gradient($from, $to); /* Opera 11.10+ */
// extras from http://www.colorzilla.com/gradient-editor/
background: -ms-linear-gradient(top, $from 0%,$to 100%); /* IE10+ */
background: linear-gradient(to bottom, $from 0%,$to 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$from', endColorstr='$to',GradientType=0 ); /* IE6-9 */
@elidickinson
elidickinson / real_ip_address.py
Created November 29, 2012 03:33
ProxiedRequest class for flask that gets correct remote_addr
from flask import Request
class ProxiedRequest(Request):
"""
`Request` subclass that overrides `remote_addr` with Frontend Server's
HTTP_X_FORWARDED_FOR when available.
"""
@property
def remote_addr(self):
@elidickinson
elidickinson / gist:4173065
Created November 30, 2012 01:09
Edudemic Signup Form Snippet
<!-- ======================= begin newsletter signup code ======================= -->
<style>
#ed_signup_box {
background: #E8E8E8;
margin: 10px 0;
padding: 10px;
border: 1px solid #D62828;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
<table cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="300" height="40" bgcolor="#a10000" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #fff; font-weight: bold; font-family: Helvetica, Arial, sans-serif; display: block;">
<a href="http://www.EXAMPLE.com/" style="color: #fff; text-decoration: none; line-height:40px; width:100%; display:inline-block">
Button Text Goes Here
</a>
</td>
</tr>
</table>
#!/bin/bash
# Get the directory that this script is running from and cd to there
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
echo "Deploying $DIR"
# tell hyde to rebuild whole site to production_deploy and note the
# script will bail out if hyde returns an error
hyde gen -c production.yaml -r -d production_deploy/ || exit $?
# copy only changed files to the server
rsync -cvraz --delete production_deploy/* user@example.com:/var/www/
@elidickinson
elidickinson / mysql backup oneliner
Last active December 16, 2015 11:59
mysql backup oneliner (assumes proper permissions set in .my.cnf)
mysql -e 'show databases' | while read dbname; do mysqldump --complete-insert --single-transaction "$dbname" | gzip > "$dbname".sql.gz; done