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> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<link href="favicon.ico" rel="icon" type="image/x-icon" /> | |
<title>Page title</title> | |
<meta name="description" content="Page description, shows up in search results. Should be no longer than 150-160 characters." /> |
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
{ | |
"content_item": { | |
"id": 81424633, | |
"create_time": "2014-09-19T23:36:06Z", | |
"last_modified_time": "2014-09-20T22:58:13Z", | |
"expire_time": null, | |
"slug": "la-me-pc-gov-brown-disposes-of-bills-20140919", | |
"title": "Governor disposes of mandating diaper changing stations in men's rooms", | |
"display_time": "2014-09-20T00:02:00Z", | |
"ad_keywords": null, |
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 prettifyGoogleSheetsJSON(data) { | |
for (var i = 0; i < data.feed.entry.length; i++) { | |
for (var key in data.feed.entry[i]) { | |
if (data.feed.entry[i].hasOwnProperty(key) && key.substr(0,4) === 'gsx$') { | |
// copy the value in the key up a level and delete the original key | |
data.feed.entry[i][key.substr(4)] = data.feed.entry[i][key].$t; | |
delete data.feed.entry[i][key]; | |
} | |
} | |
} |
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.db import models | |
class User(models.Model): | |
# Django's auth framework provides its own very | |
# capable user model, but we'll make our own | |
# assuming English/Western-style names – | |
# first name/last name distinction doesn't apply in all cultures | |
first_name = models.CharField(max_length=64) |
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
// Takes a year, month, and day number and outputs a string in the format "Dec 05, 2012". | |
// 'month' input parameter starts with zero. | |
function convertDateToEnglishString(day, month, year) { | |
var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', | |
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
try { | |
var monthName = monthNames[month]; | |
} catch (e) { | |
alert('Invalid date'); | |
return; |
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
#include <iostream> | |
#include <string> | |
#include <iomanip> | |
using namespace std; | |
int main(){ | |
const int FIRST_COL_WIDTH = 20; | |
const int SECOND_COL_WIDTH = 10; |
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
# use two-space tabs for JavaScript | |
path = require 'path' | |
atom.workspaceView.eachEditorView (editorView) -> | |
editor = editorView.getEditor() | |
filepath = editor.getPath() | |
# set Tab Length for JS sources | |
if path.extname(filepath) is '.js' |
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 astContains(ast, nodeType) { | |
walk(ast, function(node) { | |
if (node.type === nodeType) | |
return true; | |
}); | |
return false; | |
} |
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
def list(self, request, *args, **kwargs): | |
# get the base url without any query params | |
url = request.path | |
params = [] | |
# build a list of 2-value tuples which contains query params | |
for key, value in request.GET.iteritems(): | |
params.append((key, value)) | |
if params: | |
# sort the params so e.g., ?bunny=cute&fox=sly is treated as the | |
# same key as ?fox=sly&bunny=cute |
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
var ALL_SPORTS = "[all sports]"; | |
var ALL_YEARS = "[all years]"; | |
var FilterableChampionshipList = React.createClass({ | |
getInitialState: function() { | |
return { | |
viewingSport: ALL_SPORTS, | |
viewingYear: ALL_YEARS | |
}; | |
}, |