Skip to content

Instantly share code, notes, and snippets.

View appkr's full-sized avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@appkr
appkr / jsbin.nucida.js
Last active August 29, 2015 14:14
JavaScript Ternary Operator and Assignment using Logical Operator// source http://jsbin.com/nucida
var armory = {
swords: [
"Broadsword",
"Claymore",
"Scimitar"
],
addSword: function(sword) {
this.swords = this.swords || [];
this.swords.push(sword);
},
@appkr
appkr / jsbin.yeduyi.js
Last active August 29, 2015 14:14
JavaScript Switch Block// source http://jsbin.com/yeduyi
function Knight(name, regiment) {
this.name = name;
this.regiment = regiment;
switch(regiment) {
case 1:
this.weapon = "Broadsword";
break;
case 2:
this.weapon = "Claymore";
@appkr
appkr / jsbin.fozugi.js
Last active August 29, 2015 14:14
JavaScript SpeedTest Class// source http://jsbin.com/fozugi
//noprotect
function SpeedTest(testImplement, testPrams, repetitions) {
this.testImplement = testImplement;
this.testPrams = testPrams;
this.repetitions = repetitions || 10000;
this.average = 0;
}
SpeedTest.prototype = {
@appkr
appkr / gist:b77c39fbe3f903555e27
Created January 28, 2015 05:57
Html meta tag for Social Graph integration
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="">
<meta name="twitter:creator" content="">
<meta name="twitter:title" content="">
<meta name="twitter:description" content="">
<meta name="og:title" content="">
@appkr
appkr / jsbin.necegu.js
Last active August 29, 2015 14:14
JavaScript Inheritance for Performance// source http://jsbin.com/necegu
//noprotect
function SignalFire(ID, startingLogs) {
this.fireID = ID;
this.logsLeft = startingLogs;
}
SignalFire.prototype = {
addLogs: function(numLogs) {
this.logsLeft += numLogs;
@appkr
appkr / index.html
Created January 28, 2015 08:38
JavaScript DocumentFragment // source http://jsbin.com/yayoni
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="JavaScript DocumentFragment" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<h1>Knights of the Week !</h1>
@appkr
appkr / jsbin.jugebu.js
Last active August 29, 2015 14:14
jQuery Functions// source http://jsbin.com/jugebu
(function() {
$.hello = function() {
alert("Hello there!");
};
})(jQuery);
$.hello();
@appkr
appkr / index.html
Created January 29, 2015 05:14
jQuery Plugin // source http://jsbin.com/xuziwa
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta name="description" content="jQuery Plugin" />
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.example {
width: 50px;
@appkr
appkr / gist:65b9cf9e973e7f71e8a7
Last active August 29, 2015 14:14
Css Media Queries
/* Portrait */
@media screen and (orientation:portrait) {
/* Portrait styles */
}
/* Landscape */
@media screen and (orientation:landscape) {
/* Landscape styles */
}
@appkr
appkr / gist:02aac48f85871575b03a
Created January 30, 2015 04:41
Laravel Sub-queries in Eager Loading
public function findByUsername($username) {
return User::with('statuses' => function($query) {
$query->latest();
})->whereUsername($username)->first();
}