Skip to content

Instantly share code, notes, and snippets.

View codyphobe's full-sized avatar
🏍️
Chasing the sunset

Cody codyphobe

🏍️
Chasing the sunset
View GitHub Profile
@codyphobe
codyphobe / placeholders.js
Created December 16, 2013 07:46 — forked from codeguy/placeholders.js
Add placeholder attribute fallback for older browsers
placeholderSupport = ("placeholder" in document.createElement("input"));
if (placeholderSupport === false) {
$('[placeholder]').each(function () {
var $input = $(this),
placeholder = $input.attr('placeholder');
$input
.val(placeholder)
.focus(function () {
@codyphobe
codyphobe / 0_reuse_code.js
Created January 10, 2014 05:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@codyphobe
codyphobe / Ajax-Instructions.md
Created April 25, 2014 00:57 — forked from msurguy/Ajax-Instructions.md
Morris bar charts with AJAX (Laravel)

Did I hear you wanted AJAX charts instead of hard coded? You got it.

Follow this guide to integrate bar chart reports into your Laravel application with AJAX. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

@codyphobe
codyphobe / composer.json
Last active August 29, 2015 14:21
Laravel & Websockets
"textalk/websocket": "1.0.*",
"cboden/ratchet": "0.3.*"
@codyphobe
codyphobe / PreventReplayAttack.php
Last active August 29, 2015 14:21 — forked from Kreshnik/PreventReplayAttack.php
Laravel 5 - PreventReplayAttack Middleware
<?php namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Cache\Repository as Cache;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Session;
class PreventReplayAttack
{

NOTE I'm trying to find the most optimal fav/touch icon setup for my use-cases. Nothing new here. Read Mathias Bynens' articles on re-shortcut-icon and touch icons, a FAQ or a Cheat Sheet for all the details.

I'd like to hear how you approach this: @valuedstandards or comment on this gist.

The issue

You have to include a boatload of link elements pointing to many different images to provide (mobile) devices with a 'favicon' or 'touch icon':

![Touch Icon Links](https://o.twimg.com/2/proxy.jpg?t=HBj6AWh0dHBzOi8vcGhvdG9zLTYuZHJvcGJveC5jb20vdC8yL0FBRGFGY1VRN1dfSExnT3cwR1VhUmtaUWRFcWhxSDVGRjNMdXFfbHRJWG1GNFEvMTIvMjI3OTE2L3BuZy8xMDI0eDc2OC8yL18vMC80L1NjcmVlbnNob3QlMjAyMDE1LTA0LTE0JTIwMTYuNTYuMjYucG5nL0NNejBEU0FCSUFJZ0F5Z0JLQUkvNGR1eDZnMzZmYnlzYWI3

@codyphobe
codyphobe / markdown.css
Last active August 29, 2015 14:25 — forked from imjasonh/markdown.css
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@codyphobe
codyphobe / redis_socketio.js
Last active August 29, 2015 14:25 — forked from lukepolo/Laravel - Socket.IO + Redis
Redis-backed WebSocket server using Socket.IO
var base_path = __dirname.replace('resources/nodejs', '');
require('dotenv').config({
path: base_path+'.env'
});
var port = process.env.NODE_SERVER_PORT,
redis = require('redis'),
redis_client = redis.createClient(),
cookie = require('cookie'),
os = require('os'),
@codyphobe
codyphobe / nginx.conf
Last active August 29, 2015 14:25 — forked from hilbix/nginx.conf
Example for Cookie-based Access Token with NginX HttpSecureLinkModule http://wiki.nginx.org/HttpSecureLinkModule and PHP (in this case for Typo3). Note that Typo3 needs to set the cookie as shown in token.php
# Excerpt of nginx config file
#..
#
set $ts 0;
if ($cookie_TOKEN ~ ",(.*)$") {
set $ts $1;
}
secure_link $cookie_TOKEN; # See TYPO3_ACCESSTOKEN
set $sec CHANGE_THIS_SHARED_SECRET; # See TYPO3_ACCESSKEY
secure_link_md5 $sec$ts$sec;
[
{
"command": "escape"
},
{
"command": "expand_selection",
"args": {"to": "word"}
},
{
"command": "copy"