Skip to content

Instantly share code, notes, and snippets.

Three.JS Cubes

@zollinger
zollinger / analytics.service.js
Last active May 25, 2016 09:06
Services with Angular 1.* and ES6
import BaseService from './base.service';
class AnalyticsService extends BaseService {
constructor($http) {
'ngInject';
super(...arguments);
}
fetchSomething() {
return this.$http.get('/api/analytics/something');
#!/usr/bin/env python
from collections import defaultdict
import json
import sys
MIN_WORD_LEN = 2
def groupByAnagrams(inputFile):
''' inputFile should have one word per line '''
@zollinger
zollinger / sitemap.php
Created December 5, 2012 12:01
Google Sitemap with PHP
<?php
class Sitemap {
/**
* Maximum size of a single sitemap file.
* Defaults to 9MB
*/
public $maxFileSize = 9437184;
@zollinger
zollinger / getcolor.py
Last active March 11, 2023 15:57
Simple way to get dominant colors from an image in Python
from PIL import Image, ImageDraw
import argparse
import sys
def get_colors(image_file, numcolors=10, resize=150):
# Resize image to speed up processing
img = Image.open(image_file)
img = img.copy()
img.thumbnail((resize, resize))
@zollinger
zollinger / init-cake-site.sh
Created November 29, 2010 14:16
Set up a new cakephp project
#!/bin/bash
CAKE_SITES_PATH="/home/stefan/wwwroot/cake/"
BASE_APP_PATH="/home/stefan/wwwroot/cake/app"
APACHE_VHOSTS_CONFIG="/etc/apache2/sites-enabled/all"
HOSTS_FILE="/etc/hosts"
if [ $# -ne 1 ]
then
echo "Usage - $0 project name"
@zollinger
zollinger / dir2json.php
Created November 10, 2010 19:00
Outputs contents of a directory in json
<?php
/**
* GET Params:
* dir => dir name
* abspath => true/false
*/
header('Content-type: application/json');