Skip to content

Instantly share code, notes, and snippets.

View hyyan's full-sized avatar

Hyyan Abo Fakher hyyan

View GitHub Profile
@hyyan
hyyan / history.js
Created September 10, 2024 13:30 — forked from kottenator/history.js
Document title & History API
var button = document.createElement('button');
button.textContent = 'Push';
document.body.appendChild(button);
var x, title;
if (!history.state) {
x = 0;
title = document.title;
// Without this we can loose the initial page's title on browser navigation
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
@hyyan
hyyan / format.js
Created July 17, 2018 11:35
Formate date/time in javascript
function format(date, format) {
if (!date || !format) {
return;
}
if (format.toLowerCase() === "short") {
format = "dd-MM-yyyy";
}
if (format.toLowerCase() === "medium") {
format = "dd-MM-yyyy hh:mm:ss";
}
@hyyan
hyyan / coding-html5-javascript-linear-gauge.markdown
Created April 26, 2018 20:41
Coding HTML5/Javascript Linear Gauge
@hyyan
hyyan / index.html
Created April 26, 2018 20:24
Simple Javascript Painter Demo
<div class="tools">
<label>
Bruch Color
<input id="color" type="color" value="#f00" />
</label>
<label>
Bruch Size
<input id="size" type="number" value="10" />
</label>
@hyyan
hyyan / index.html
Last active November 11, 2017 22:50
<!DOCTYPE html>
<html lang="en">
<head>
<title>Service Workers</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<h1>Service Workers Rocks</h1>
<button id="updateButton" style="display: none">Update Now</button>
let cacheName = 'cache-v1';
self.addEventListener('install', (e) => {
let cache = caches.open(cacheName).then((c) => {
c.addAll([
'/index.css'
]);
});
<?php
require_once 'vendor/autoload.php';
use Jaguar\Canvas,
Jaguar\Transformation,
Jaguar\Action\Color\Boost,
Jaguar\Action\Blur\SelectiveBlur,
Jaguar\Action\Posterize,
Jaguar\Action\EdgeDetection;
<?php
require_once 'vendor/autoload.php';
use Jaguar\Canvas,
Jaguar\Transformation,
Jaguar\Action\Color\Grayscale,
Jaguar\Action\EdgeDetection,
Jaguar\Action\Color\Negate;
@hyyan
hyyan / css3-masonry-grid.markdown
Created October 29, 2016 20:02
CSS3 Masonry Grid

CSS3 Masonry Grid

Simple CSS3 Masonry Grid , which can be used to create image gallery or to display posts grid wih no Javascript

A Pen by Hyyan Abo Fakher on CodePen.

License.