Skip to content

Instantly share code, notes, and snippets.

View jenalgit's full-sized avatar
💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃

jenal jenalgit

💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃
View GitHub Profile
@jenalgit
jenalgit / index.html
Created March 25, 2018 11:31 — forked from nithinbekal/index.html
HTML5 Todo App source
<!doctype html>
<html>
<head>
<title>My Todo List</title>
<style>
body { background: #0f0f0f; font-family: Tahoma, sans-serif; font-size: 11px; }
header, section, footer { display: block; }
#container { background-color: #eee; margin: 0 auto; width: 300px; border: 4px solid #222; }
header h1 { text-align: center; margin: 0; padding: 15px 0;}
label { display: block; padding-bottom: 5px; text-align: center; }
@jenalgit
jenalgit / index.php
Created March 20, 2018 05:56 — forked from ziadoz/index.php
Simple PHP / jQuery CSRF Protection
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}
@jenalgit
jenalgit / Mercator Projection.js
Created March 14, 2018 13:24 — forked from korya/Mercator Projection.js
Mercator Projection for Google Maps JS SDK
// Base tile size used in Google Javascript SDK
const GOOGLE_BASE_TILE_SIZE = 256;
// MercatorProjection implements the Projection interface defined in Google Maps
// Javascript SDK.
//
// Google Maps Javascript SDK docs:
// https://developers.google.com/maps/documentation/javascript/maptypes#WorldCoordinates
//
// For more details about the convertions see
@jenalgit
jenalgit / project.js
Created March 14, 2018 13:20 — forked from matsadler/project.js
JavaScript mercator projection
/*jslint vars: true */
// adapted from http://wiki.openstreetmap.org/wiki/Mercator#JavaScript
(function () {
var project = {};
if (typeof exports === "object") {
module.exports = project;
} else {
this.project = project;
@jenalgit
jenalgit / inactivity.js
Created March 12, 2018 05:38 — forked from gerard-kanters/inactivity.js
Inactivity timeout javascript
<script type="text/javascript">
function idleTimer() {
var t;
//window.onload = resetTimer;
window.onmousemove = resetTimer; // catches mouse movements
window.onmousedown = resetTimer; // catches mouse movements
window.onclick = resetTimer; // catches mouse clicks
window.onscroll = resetTimer; // catches scrolling
window.onkeypress = resetTimer; //catches keyboard actions
@jenalgit
jenalgit / git-pull-all
Created March 1, 2018 06:13 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@jenalgit
jenalgit / IndexedDB101.js
Created February 27, 2018 05:43 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@jenalgit
jenalgit / countries.sql
Created January 31, 2018 07:40 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@jenalgit
jenalgit / download-mozilla-portable.sh
Created December 5, 2017 04:13 — forked from rubo77/download-mozilla-portable.sh
a script that downloads a certain Firefox or Thunderbird version and installs it in an extra folder to create an independent and portable App for Linux. source: http://portableapps.com/node/16344
#!/bin/sh
# Configure the following default variables according to your requirements
language="en-US" # e.g. "de" or "en-US"
if [ ! "$1" ]; then
# default if no argument is set:
version="30.0" # chose from http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/
application="firefox" # "thunderbird" or "firefox" but file extension, archive extraction, and binary ########################################################
fi
@jenalgit
jenalgit / add_two_times.js
Created November 20, 2017 08:58 — forked from joseluisq/add_two_times.js
Sum two times values HH:mm:ss with javascript
/**
* Sum two times values HH:mm:ss with javascript
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
*
* @param {string} start
* @param {string} end
* @returns {String}
*/