Skip to content

Instantly share code, notes, and snippets.

@cviebrock
cviebrock / gist:6598105
Created September 17, 2013 18:00
Convert `"/Date()/"` dates from JSON to DateTime objects.
function convertJsonDate( $string ) {
if ( preg_match('#^/Date\((-?\d+)([+-]\d+)?\)/$#', $string, $matches) ) {
$ds = intval( $matches[1] ) / 1000;
$dm = intval( $matches[1] ) % 1000;
$tz = '+000';
if ( isset($matches[2]) ) {
$tz = $matches[2];
}

index.html:

<html lang="en">
	<head>
	</head>
	<body>
		...
		<script data-main="/js/config" src="/js/lib/require.min.js"></script>
 
@cviebrock
cviebrock / select2-foundation5.css
Created December 20, 2013 15:56
Select2 CSS for Zurb Foundation 5
/*
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
*/
.select2-container {
margin: 0 0 1rem 0;
position: relative;
vertical-align: middle;
font-family: inherit;
-webkit-appearance: none !important;
font-size: 0.875rem;
$data = $YOUR_QR_STUFF->getImage();
ob_start();
imagepng($data);
$image_data = ob_get_contents();
ob_end_clean();
store_stuff_in_redis($key, $data);
@cviebrock
cviebrock / cviebrock.zsh-theme
Last active May 2, 2017 21:18
my zsh theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@cviebrock
cviebrock / laracon-slides.md
Last active September 1, 2016 22:32
Just a collection of links to all the slide decks used at Laracon 2015 in Louisville, KY.
@cviebrock
cviebrock / wez.itermcolors
Last active September 6, 2015 22:20 — forked from wez/wez.itermcolors
Wez's iTerm 2 Colour selection
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@cviebrock
cviebrock / ListOfValidator.php
Created November 30, 2015 21:38
Validate a list of things
<?php
namespace App\Validators;
use Illuminate\Contracts\Validation\Validator;
class ListOfValidator
{
public function validate($attribute, $value, $parameters, Validator $validator)
@cviebrock
cviebrock / keybase.md
Created January 18, 2016 19:11
keybase.md

Keybase proof

I hereby claim:

  • I am cviebrock on github.
  • I am cviebrock (https://keybase.io/cviebrock) on keybase.
  • I have a public key whose fingerprint is 5099 35DF 565A 490D E8B4 C4B9 B5CD D17A 2B4A 066B

To claim this, I am signing this object:

@cviebrock
cviebrock / rating.php
Created September 21, 2016 02:24
Quick script to calculate the change in Scrabble rating between yourself and a field of opponents
<?php
if ($argc < 3) {
echo <<< EOB
USAGE: {$argv[0]} myRating opp1rating [opp2rating...]
EOB;
exit(1);
}