Skip to content

Instantly share code, notes, and snippets.

View appkr's full-sized avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@appkr
appkr / gist:a8efbe1ac026ec4026c9
Created January 30, 2015 04:43
Html viewport definition
<meta name="viewport" content="initial-scale=1, width=device-width, user-scalable=no">
@appkr
appkr / gist:e102e0855270da071b1a
Last active August 29, 2015 14:14
JavaScript numberFormat(), formatFileSize
var Utility = {
getBitRate = function(size, duration) {
return numberFormat(Math.round((size * 8) / duration));
},
numberFormat = function(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
},
@appkr
appkr / gist:094f82023fac0289756d
Created February 3, 2015 01:16
jQuery PubSub (Observer Pattern)
(function($) {
var o = $({});
$.each({
trigger: 'publish',
on: 'subscribe',
off: 'unsubscribe'
}, function(key, api) {
$[api] = function() {
o[key].apply(o, arguments);
@appkr
appkr / gist:135faee654ebfb9bb991
Last active August 29, 2015 14:14
jQuery anatomy of Deferred
(function($) {
var myVar;
var setVal = function() {
var deferred = $.Deferred();
setTimeout(function() {
myVar = 'myValue';
deferred.resolve();
}, 2000);
@appkr
appkr / gist:4f7538622ab54659b879
Created February 5, 2015 00:47
jQuery Plugin Template
// Polyfill for Old Browser
if (typeof Object.create !== "function") {
Object.create = function(obj) {
function F() {};
F.prototype = obj;
return new F();
}
}
// Plugin
@appkr
appkr / imports.html
Created April 2, 2015 00:53
Polymer/Webcomponents conditional polyfill
<script>
if ('registerElement' in document
&& 'createShadowRoot' in HTMLElement.prototype
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')) {
// We're using a browser with native WC support!
} else {
document.write(
'<script src="https:\/\/cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.6.0/webcomponents.min.js"><\/script>'
);
@appkr
appkr / gist.blade.php
Last active January 23, 2016 03:39
Embed gist files in page (capable of selecting part of lines, hightlight...)
@extends('layouts.master')
@section('content')
<div>
{{--To correctly styling as we specified, we can use div element instead of code--}}
<code data-gist-id="baaa8af6ac065998f417" data-gist-line="1-11" data-gist-highlight-line="1,3,5" {{--data-gist-hide-footer="true"--}} data-gist-show-spinner="true"></code>
</div>
@stop
@section('script')
@appkr
appkr / cgilib.pl
Last active February 20, 2016 12:20
old school
sub cgiReadInput {
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
}
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$query_string = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $query_string);
@appkr
appkr / Contract Killer 3.md
Created February 27, 2016 12:58 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@appkr
appkr / .bowerrc
Last active April 5, 2016 06:59
Laravel 5 Front-end Scaffolding
{
"analytics": false,
"directory": "resources/assets/vendor"
}