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/python | |
"""Simple HTTP Server. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" | |
__version__ = "0.6" |
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
/** | |
* Find the average color of an image | |
* | |
* USAGE: getAvgColorOfImg('<url to image file>') | |
*/ | |
getAvgColorOfImg = (u,i = new Image) => { | |
i.crossOrigin = ''; | |
i.src = u; | |
i.onload = e => { | |
x = (c = document.createElement('canvas')).getContext('2d'); |
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
{ | |
"editor.fontFamily": "OperatorMonoLig-Book", | |
"editor.fontLigatures": true, | |
"eslint.autoFixOnSave": true, | |
"files.eol": "\n", | |
"workbench.colorTheme": "One Dark Pro", | |
"breadcrumbs.enabled": false, | |
"editor.suggestSelection": "first", | |
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", | |
"indentRainbow.tabmixColor": "rgba(128,32,96,0.2)", |
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
/** | |
* String.capitalize - Capitalize the first character of a string. | |
* | |
* Example: | |
* const foo = "this is a headline" | |
* foo.capitalize() | |
* This is a headline | |
*/ | |
String.prototype.capitalize = function() { | |
return this.charAt(0).toUpperCase() + this.slice(1); |
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 chokidar = require('chokidar'); | |
// Initialize watcher. | |
const watcher = chokidar.watch('/Users/kea1080/Documents/nmdiary', { | |
ignored: /(^|[\/\\])\../, // ignore dotfiles | |
persistent: true | |
}); | |
// Something to use when events are received. | |
const log = console.log.bind(console); |
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
import moment from 'moment'; | |
/** | |
* A business needs to know the hours in which it operates. | |
* | |
* Import `getBusinessHours` and get access to: | |
* - isCurrentlyOPen() - bool on wether or not the cafe is currently open | |
* - todaysWeekInt() - todays week number. Zero-based (Sunday=0) | |
* - getDayMeta(int) - returns the given days business hour meta as an object | |
* |
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
module.exports = { | |
category: [ | |
{ id: 1, title: 'Breakfast', slug: 'breakfast', description: 'Changes Regularly - Febuary 1, 2016', }, | |
{ id: 2, title: 'Lunch', slug: 'lunch', description: 'Changes Regularly - Febuary 1, 2016', }, | |
{ id: 3, title: 'Evening', slug: 'evening', description: 'from 4pm - 8pm Tues. - Sat.', }, | |
{ id: 4, title: 'Wine, Beer, Cocktails', }, | |
{ id: 5, title: 'Sparkling', }, | |
{ id: 6, title: 'Rose', }, | |
{ id: 7, title: 'White', }, | |
{ id: 8, title: 'Red', }, |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>React + JSX + LESSCSS</title> | |
<!-- LESS style must come before the actual loading of less.js --> | |
<style type="text/less"> | |
.container { | |
width: 90%; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>React + JSX + LESSCSS</title> | |
<!-- LESS style must come before the actual loading of less.js --> | |
<style type="text/less"> | |
.container { | |
width: 90%; |
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
"""Iterate over User Profiles and push some fields to MailChimp. | |
This script assumes you already have a (lenghty) list setup on | |
mailchimp.com. It also assumes that you have a Django project utilizing | |
the Auth app and the User object's UserProfile (MemberProfile here). | |
It's all too custom to drop in and go, but have a look. This is how I | |
managed to push our Membership data into MailChimp. Learned a bunch of | |
stuff in the process. | |