Skip to content

Instantly share code, notes, and snippets.

View daspecster's full-sized avatar
🏠
Working remote

Thomas Schultz daspecster

🏠
Working remote
View GitHub Profile
@daspecster
daspecster / gist:9283442
Created March 1, 2014 01:31
Sublime Prefs
{
"color_scheme": "Packages/Ciapre Color Scheme/CiapreBlack.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 19.0,
"ignored_packages":
[
"JSLint",
"Vintage",
"BracketHighlighter"
@daspecster
daspecster / ziptastic-form.html
Last active August 29, 2015 13:57
Ziptastic Form Example
<form id="theform" class="pure-form pure-form-stacked">
<fieldset>
<label for="name">
Name:
<input type="text" id="name" placeholder="Full Name"/>
</label>
<label for="address1">
Address:
<input type="text" id="address" placeholder="House Number, Street" />
</label>
@daspecster
daspecster / Code-Standards.md
Last active August 29, 2015 14:05
Code Standards and Resources
@daspecster
daspecster / gist:6111937171e0f83c1391
Created February 25, 2015 19:10
GetZiptastic.com Version 3 jQuery example
$.ajax({
type: "GET",
beforeSend: function(request) {
request.setRequestHeader("x-referrer", "<your domain here. example.com>");
request.setRequestHeader("x-key", "<your api key here>");
},
url: "https://zip.getziptastic.com/v3/US/48867",
success: function(data) {
console.log(data);
}
@daspecster
daspecster / Availability-Indicator.markdown
Last active August 29, 2015 14:16
Availability Indicator

Availability Indicator

This is a simple way to indicate the best times for a client to contact you via a given medium. This could be used for chat, twitter, skype etc...

TODO: Add in timezone support.

A Pen by Thomas Schultz on CodePen.

License.

@daspecster
daspecster / page.html
Last active August 29, 2015 14:16
PHP Ziptastic multi-step form example page 1
<html>
<body>
<form action="/next_page.php" method="get">
Postal Code: <input type="text" name="postalcode">
<input type="submit">
</form>
</body>
</html>
@daspecster
daspecster / next_page.php
Created March 11, 2015 00:16
PHP Ziptastic multi-step form example page 2
<?php
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"x-referrer: " . $_SERVER['HTTP_REFERER'] . " \r\n"
)
);
$postal_code = strip_tags(htmlspecialchars($_POST['postalcode'], ENT_QUOTES));
@daspecster
daspecster / GulpFile.js
Created May 8, 2015 02:58
ReactTheme GulpFile
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
gulp.task('sass', function () {
gulp.src(['./css/theme.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(concat('theme.css'))
.pipe(gulp.dest('./css/compiled/'));
});
from math import log
def to_decimal(n, base):
if n < 10:
return n
p = int(log(n, 10))
msb = base ** p
n -= 10 ** p
@daspecster
daspecster / multi-process-logging.py
Last active August 29, 2015 14:24
Multi process logging with os.fork() and logging module
import os
import logging
def generate_primes(number):
logger = logging.getLogger(str(os.getpid()) + ':logger')
for num in range(number + 1):
# prime numbers are greater than 1
if num > 1: