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
let message: string = 'Hello, World!'; | |
console.log(message); |
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
const got = require('got'); // HTTP request client | |
const { CONTENT_API_URL, CONTENT_API_SANDBOX_URL } = require('./urls'); | |
class ContentApiClient { | |
constructor() { | |
this.API_ENDPOINT = CONTENT_API_URL; | |
this.queryContentApi = null; | |
} | |
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
select DATE_FORMAT(createdAt, "%Y-%m-01") AS month, count(choice) as votesTotal, | |
(SELECT count(choice) | |
FROM survey | |
WHERE choice = 'no' | |
AND YEAR(createdAt) = YEAR(month) AND MONTH(createdAt) = MONTH(month) | |
) AS numNoVotes, | |
(SELECT 100 - numNoVotes / count(choice) * 100) AS percentageVotedYes | |
from survey | |
GROUP BY DATE_FORMAT(createdAt, "%Y-%m-01") |
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
#!/usr/bin/env node | |
'use strict'; | |
const _ = require('lodash'); | |
const mysql = require('mysql'); | |
require('dotenv').config(); | |
const db = mysql.createConnection({ | |
host: 'localhost', | |
user: 'root', |
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
def resize_images(image_field): | |
pathname, filename = path.split(image_field.path) | |
img_file = Image.open(image_field.path) | |
# Convert to RGB | |
if img_file.mode not in ('L', 'RGB'): | |
img_file = img_file.convert('RGB') | |
# Save a thumbnail file for each of the given dimensions, | |
# prefixed with med_, small_ etc |
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
// use this where you'd otherwise use '&:hover' | |
// to get accessible styling for keyboard navigation too | |
@mixin on-interact { | |
&:active, | |
&:focus, | |
&:hover { | |
@content; | |
} | |
} |
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
#!/usr/bin/env python | |
import sys | |
import boto | |
import boto.ec2 | |
import boto.ec2.elb | |
import boto.rds | |
import pprint | |
import argparse | |
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
#!/bin/bash | |
# this script does four things: | |
# | |
# 1. detects any crop marks (black bars) on the source clip | |
# 2. uses those crop marks to trim the clip so it has no bars (semi-manual task) | |
# 3. scales the video up ands crops it (from the center) to snapchat size | |
# 4. trims the clip to 10s long (might make sense to do this step first?) | |
INPUT='vid.mp4' |
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script> | |
function apiRequest(apiKey) { | |
var that = this; | |
var deferred = $.Deferred(); | |
this.response = {}; | |
function ajax() { | |
$.ajax({ |
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
var allStylesheets = document.styleSheets; | |
var classesUsed = []; | |
[].forEach.call(allStylesheets, function(sheet) { | |
for (var i = 0; i < allStylesheets.length; i++) { | |
try { | |
var sheet = allStylesheets[i]; | |
for (var j = 0; j < sheet.cssRules.length; j++) { | |
classesUsed.push(sheet.cssRules[j].selectorText); | |
} |
NewerOlder