collected wisdom on REST API best practice.
- 200 : OK – Eyerything is working
- 201 : OK – New resource has been created
- 204 : OK – The resource was successfully deleted
- 304 : Not Modified – The client can use cached data
#EXTM3U | |
#EXTINF:-1,BBC - Radio 1 | |
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p | |
#EXTINF:-1,BBC - Radio 2 | |
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p | |
#EXTINF:-1,BBC - Radio 3 | |
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls | |
#EXTINF:-1,BBC - Radio 4 | |
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p | |
#EXTINF:-1,BBC - Radio 5 live |
<?php | |
class StrCSV | |
public function strPutCsv($input, $delimiter = ',', $enclosure = '"') | |
{ | |
// Open a memory "file" for read/write... | |
$fp = fopen('php://memory', 'r+'); | |
// ... write the $input array to the "file" using fputcsv()... | |
fputcsv($fp, $input, $delimiter, $enclosure); | |
// ... rewind the "file" so we can read what we just wrote... | |
rewind($fp); |
// Avoid `console` errors in browsers that lack a console. | |
(function() { | |
var method; | |
var noop = function () {}; | |
var methods = [ | |
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', | |
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', | |
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', | |
'timeStamp', 'trace', 'warn' | |
]; |
<?php | |
// Do something more robust in production to check it's a valid post etc | |
// also use Monolog or similar to log, but hey this is an example :) | |
$logMessage = sprintf( | |
'JS_ERROR[%s] URL[%s] on file[%s:%s] UA[%s]', | |
$_POST['errorMessage'], | |
$_POST['url'], | |
$_POST['file'], | |
$_POST['lineNumber'], |
//*********** IMPORTS ***************** | |
var gulp = require('gulp'); | |
var sass = require('gulp-ruby-sass'); | |
var gutil = require('gulp-util'); | |
var rename = require("gulp-rename"); | |
var map = require("map-stream"); | |
var livereload = require("gulp-livereload"); | |
var concat = require("gulp-concat"); | |
var uglify = require('gulp-uglify'); | |
var watch = require('gulp-watch'); |
<?php | |
$function_filedate = new Twig_SimpleFunction( | |
'fileDate', | |
/** | |
* @param $file_path | |
* This function generates a new file path with the last date of filechange | |
* to support better better client caching via Expires header: | |
* i.e: |
<?php | |
/** | |
* dump args surrounded in html pre block and die | |
* | |
* @param mixed $args,... variable number of arguments | |
*/ | |
function dd() { | |
echo '<pre>'; | |
call_user_func_array('var_dump',func_get_args()); | |
echo '</pre>'; |
Encrypt Archive.zip saving as Archive.zip.dat, you'll be prompted to enter a password and confirm it
openssl enc -aes-256-cbc -in Archive.zip >Archive.zip.dat
Decrypt Archive.zip.dat saving as Archive.zip, you'll be prompted to enter the password you used to encrypt it
#!/usr/bin/env bash | |
TARGET_DIR=~/temp_dir git archive --format=tar HEAD | (cd $TARGET_DIR && tar xf -) |