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.
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: |
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 |
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/')); | |
}); |
<?php | |
$opts = array( | |
'http'=>array( | |
'method'=>"GET", | |
'header'=>"x-referrer: " . $_SERVER['HTTP_REFERER'] . " \r\n" | |
) | |
); | |
$postal_code = strip_tags(htmlspecialchars($_POST['postalcode'], ENT_QUOTES)); |
<html> | |
<body> | |
<form action="/next_page.php" method="get"> | |
Postal Code: <input type="text" name="postalcode"> | |
<input type="submit"> | |
</form> | |
</body> | |
</html> |
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.
$.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); | |
} |
Backup and restore databases | |
# Backup | |
pg_dump -h <orig db> -U <user> -Fc > data.backup | |
psql in to db... | |
$ drop schema public cascade; | |
$ \connect postgres | |
$ drop database <dbname>; |
Here are some resources to help us write better code and recognize code that may need some help.
# Thanks to Sebastian Kreutzberger | |
# Source: http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on-ec2 | |
# install build tools | |
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y | |
# install python 2.7 and change default python symlink | |
sudo yum install python27-devel -y | |
sudo rm /usr/bin/python | |
sudo ln -s /usr/bin/python2.7 /usr/bin/python |