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 / 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:
@daspecster
daspecster / php-list-email.txt
Created December 21, 2015 21:18
PHP List Email Example
Hello all you awesome subscribers!
Here's the best things I've found in the world of PHP this week!
- thing one
- thing two
- thing three
If you like this list, you can help it continue by using this link when you shop at Amazon.com!
@daspecster
daspecster / ziptastic-curl.sh
Created December 28, 2015 03:03
Ziptastic cURL Example
curl https://zip.getziptastic.com/v3/US/48867 " -H "x-key: 123examplekey456"
@daspecster
daspecster / after.sh
Last active January 8, 2016 22:22 — forked from justincampbell/after.sh
Jenkins + GitHub Commit Status API
if [[ $BUILD_STATUS == "success" ]]
then
export STATUS="success"
else
export STATUS="failure"
fi
curl "https://api.github.com/repos/<user/org>/<my_repo>/statuses/$GIT_COMMIT?access_token=<token>" \
-H "Content-Type: application/json" \
-X POST \
@daspecster
daspecster / ziptastic.js
Created February 2, 2016 02:44
Ziptastic jQuery example
$.ajax({
type: "GET",
beforeSend: function(request) {
request.setRequestHeader("x-key", "123examplekey456");
},
url: "//zip.getziptastic.com/v3/US/48867",
success: function(data) {
console.log(data[0].city);
console.log(data[0].state);
console.log(data)
@daspecster
daspecster / BFT.java
Created March 26, 2016 00:58
Working on BFT adjacent matrix with bfranco
import java.util.Scanner;
import java.io.*;
import java.util.LinkedList;
import java.util.Queue;
public class BFT {
public static boolean[]avail = new boolean [48]; // tells me whether or not a state has been used yet
public static int[][] dataSet = new int[48][48]; // prefilled adjacency matrix
public static String[] statesList = new String[48]; // prefilled list of states
@daspecster
daspecster / install-docker-compose.sh
Last active October 11, 2018 06:52
Centos 7 docker compose install from scratch
#!/bin/bash
sudo yum update -y
sudo yum install -y netstat git rubygems gcc kernel-devel make perl
sudo yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel maven
sudo gem install sass
cd /tmp