Skip to content

Instantly share code, notes, and snippets.

View Jwpe's full-sized avatar
🌲
Work

Jonathan Evans Jwpe

🌲
Work
View GitHub Profile
@Jwpe
Jwpe / coffee_install.sh
Last active December 15, 2015 15:19
Install CoffeeScript on Ubuntu
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm install -g coffee-script
@Jwpe
Jwpe / CoffeeScript.sublime-build
Created March 31, 2013 15:49
A build system for Sublime Text 2 that compiles CoffeeScript files into a mirrored directory structure of JavaScript files
{
"cmd": ["coffee","--compile", "--output", "${file_path/coffee/js/}", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.coffee"
}
@Jwpe
Jwpe / exists.coffee
Created July 19, 2013 15:52
A small Handlebars helper for checking that an item is not null or Undefined before rendering a block. Inspired by https://github.com/elving/swag/
Handlebars.registerHelper 'exists', (value, options) ->
if value? then options.fn(@) else options.inverse(@)
@Jwpe
Jwpe / email_generator.py
Last active August 29, 2015 13:56
A simple email personalization script in Python
# First, we construct a list of 'dictionaries', each one a set of information
# about a single lead
leads = [
{'first_name': 'Paul', 'last_name': 'McCartney', 'company': 'Beatles Inc.',
'title': 'Chief Marketing Officer'},
{'first_name': 'Nina', 'last_name': 'Simone' , 'company': 'Jazz & Soul',
'title': 'CEO' },
{'first_name': 'Michael', 'last_name': 'Jagger',
'company': 'Rolling Stone Corp', 'title': 'SVP Marketing'},
]
@Jwpe
Jwpe / seo.html
Last active August 29, 2015 13:56
Common HTML elements that contribute to search engine optimization
<!-- Here are some common elements to look for in a web page's HTML code -->
<!-- The 'description' meta tag gives us a short summary of the page as seen
by search engines -->
<meta name="description" content="A short description of the website that will
show up below the page title in search engines"/>
<!-- The 'keywords' meta tag lists important keywords that the page wants to
rank well for in search engines. Using too many keywords can devalue each
individual keyword -->
@Jwpe
Jwpe / lead_qualifier.py
Last active August 29, 2015 13:56
A Python script to separate leads into 'qualified' and 'unqualified' lists based on certain criteria
# Let's return to our list of leads, but add some additional information
# that we can use to qualify them
leads = [
{'first_name': 'Paul', 'last_name': 'McCartney', 'company': 'Beatles Inc.',
'title': 'Chief Marketing Officer', 'employees': 150,
'vertical': 'music'},
{'first_name': 'Nina', 'last_name': 'Simone' , 'company': 'Jazz & Soul',
'title': 'CEO', 'employees': 350, 'vertical': 'music'},
{'first_name': 'Michael', 'last_name': 'Jagger',
'company': 'Rolling Stone Corp', 'title': 'SVP Marketing',
@Jwpe
Jwpe / comparison.py
Created February 16, 2014 04:03
Comparison of decorator and Flask builtins
from flask import Flask, jsonify, abort, g
import flask_nicely
from flask_nicely.errors import NotFound
app = Flask(__name__)
### With decorator ###
@Jwpe
Jwpe / html_parser.py
Last active August 29, 2015 13:56
A Python script to parse some HTML from a web page
# First we 'import' a Python package - a piece of code written for a specific
# job and freely available to install - called BeautifulSoup. This package
# lets us search through the structure of HTML.
# For installation instructions, see the guide to pip at the end of the post.
from bs4 import BeautifulSoup
# Here we add our HTML document. In a more advanced example, we could fetch
# this directly from the web, but here we just copy it into our Python file.
# Notice the triple-quotes around the HTML!
html = """
@Jwpe
Jwpe / marketers.py
Created February 18, 2014 00:28
Why marketers should learn to code:
opening_line = "{}. Marketers should learn to code because {}!"
reasons = ["it will make them more efficient", "it's amazing and fun",
"it will help them to understand the technology that they work with"]
for i, reason in enumerate(reasons):
print opening_line.format(i + 1, reason)
@Jwpe
Jwpe / keybase.md
Created March 26, 2014 21:03
Keybase PGP proof

Keybase proof

I hereby claim:

  • I am Jwpe on github.
  • I am jwpe (https://keybase.io/jwpe) on keybase.
  • I have a public key whose fingerprint is 006C E8AB C67A CFFE CF3D 7026 ACBF E180 93DD 1B94

To claim this, I am signing this object: