Skip to content

Instantly share code, notes, and snippets.

@ifkas
ifkas / HTML5: Starting Template Snippet
Last active November 5, 2020 18:22
HTML5 snippet - Starter template for Sublime Text 3
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!-- Global Metas -->
@ifkas
ifkas / laravel-go-back-link.php
Created August 7, 2014 20:12
Laravel - Go to previous page link
@ifkas
ifkas / tet.js
Created February 16, 2017 20:36
Test js
// Example with parameters only, no variable in scope and anonymous inner function
function orange(color) {
return function(brand) {
return "The oranges are with " + color + " color, but the computer brand can be " + brand;
}
}
var coloring = orange("orange"); // we can also
console.log(coloring("apple"));
@ifkas
ifkas / index.html
Created November 23, 2017 06:20
Нашата прва игра / Дај што даш // source http://jsbin.com/roqibid
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Нашата прва игра / Дај што даш</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<style id="jsbin-css">
/* body {background: url(http://wallpaper-gallery.net/images/violet-wallpaper/violet-wallpaper-9.jpg) no-repeat #7F3F98;text-align:center;color: #fff;font-size: 20px;} */
body {background: #7F3F98;text-align:center;color: #fff;font-size: 20px;}
@ifkas
ifkas / jsClosure1.js
Last active February 2, 2018 10:08
JS Closure
// Example with parameter only, no variable in scope and anonymous inner function
function orange(color) {
return function(brand) {
return "The oranges are with " + color + " color, but the computer brand can be " + brand;
}
}
let coloring = orange("orange");
console.log(coloring("apple"));
// > The oranges are with orange color, but the computer brand can be apple
@ifkas
ifkas / jsClosure2.js
Last active February 21, 2018 16:24
Shared variable - JavaScript closure
function foo() {
let num = 0;
setTimeout(function(){
console.log("I have " + num++ + " apple");
},100);
setTimeout(function(){
console.log("I have " + num++ + " apple");
},300);
}
foo();
@ifkas
ifkas / jsClosure3.js
Last active February 21, 2018 16:09
IIFE example with closure
// PROBLEM
for (var i = 0; i<=3; i++) {
setTimeout(function(){
console.log("I have: " + i + " apples");
}, i*2000);
}
// > I have: 4 apples
// > I have: 4 apples
// > I have: 4 apples
@ifkas
ifkas / jsClosure4.js
Last active January 21, 2018 19:24
ES6 for loop with closure
for (let i = 0; i<=3; i++) {
setTimeout(function(){
console.log("I have: " + i + "apples");
}, i*2000);
}
// > I have: 1 apples
// > I have: 2 apples
// > I have: 3 apples
@ifkas
ifkas / jsClosure5.js
Last active February 23, 2018 11:03
Closure binding example
let count = 0;
function appleColor(color) {
return function(type) {
count++;
if(count === 1) {
document.getElementById('ate').innerHTML += '<div class="message">' + 'I ate ' + count + ' apple. ' + '<br/>' + 'It was ' + type + ' type with shiny bright ' + color + ' color. ' + `<svg id="appleSvg" fill="${color}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 50 50.001" style="enable-background:new 0 0 50 50.001;" xml:space="preserve"> <path d="M26.12,14.488c0.879-1.468,2.27-3.569,4.027-5.585h0.002c1.488-1.711,4.402-3.907,4.402-3.907 c0.438-0.331,0.391-0.792-0.107-1.024l-3.522-1.646c-0.498-0.233-1.175-0.063-1.505,0.376c0,0-2.605,3.737-5.671,11.692 c-9.48-4.288-18.491,1.718-18.491,12.162c0,10.909,8.393,27.48,19.743,22.478c11.954,5.173,19.749-11.568,19.749-22.478 C44.747,16.022,36.647,9.846,26.12,14.488z"/> <path d="M23.997,10.955c0.548-0.046,1.032-0.531,1.076-1.078c0,0,0.352-4.266-2.621-7.242c-2.982-2.977-7.2
{
"Melt": "%3Csvg width='24' height='20' viewBox='0 0 24 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 18c0-1.105.887-2 1.998-2 1.104 0 2-.895 2.002-1.994V14v6h-4v-2zM0 13.998C0 12.895.888 12 2 12c1.105 0 2 .888 2 2 0 1.105.888 2 2 2 1.105 0 2 .888 2 2v2H0v-6.002zm16 4.004A1.994 1.994 0 0 1 14 20c-1.105 0-2-.887-2-1.998v-4.004A1.994 1.994 0 0 0 10 12c-1.105 0-2-.888-2-2 0-1.105-.888-2-2-2-1.105 0-2-.887-2-1.998V1.998A1.994 1.994 0 0 0 2 0a2 2 0 0 0-2 2V0h8v2c0 1.105.888 2 2 2 1.105 0 2 .888 2 2 0 1.105.888 2 2 2 1.105 0 2-.888 2-2 0-1.105.888-2 2-2 1.105 0 2-.888 2-2V0h4v6.002A1.994 1.994 0 0 1 22 8c-1.105 0-2 .888-2 2 0 1.105-.888 2-2 2-1.105 0-2 .887-2 1.998v4.004z' fill='%232f2e31' fill-opacity='0.57' fill-rule='evenodd'/%3E%3C/svg%3E",
"Overlapping Diamonds": "%3Csvg width='48' height='64' viewBox='0 0 48 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M48 28v-4L36 12 24 24 12 12 0 24v4l4 4-4 4v4l12 12 12-12 12 12 12-12v-4l-4-4 4-4zM8 32l-6-6 10-10 10 10-6 6 6 6-10 10L2 38l6-6zm12 0l4-4