Skip to content

Instantly share code, notes, and snippets.

View Vuzereus's full-sized avatar
💭
I may be slow to respond.

Vuzereus

💭
I may be slow to respond.
View GitHub Profile
@igorjs
igorjs / gpg_git_signing.md
Created May 3, 2023 22:24 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
function calcDistanceInMetresBetweenTwoPoints(Point1, Point2) {
const EARTH_RADIUS = 6371e3; // 6,371,000 metres
const latitude1 = (Point1.lat * Math.PI) / 180;
const latitude2 = (Point2.lat * Math.PI) / 180;
const deltaLatitude = ((Point2.lat - Point1.lat) * Math.PI) / 180;
const deltaLongitude = ((Point2.lon - Point1.lon) * Math.PI) / 180;
const angle =
@ziishaned
ziishaned / output.json
Last active May 21, 2024 15:57
Build a tree from a flat array in PHP
{
"5a969a6fe799f7cbe9083122": {
"_id": "5a969a6fe799f7cbe9083122",
"name": "Tajawal",
"parent": null,
"created_by": "5a8d84b8e799f70a157f8211",
"update_at": "1519819375891",
"created_at": "1519819375891",
"children": {
"5a969f5ce799f7cbe9083123": {
@rupe120
rupe120 / PageInit.js
Created March 29, 2017 13:53
autoComplt with AJAX
function initializeLeadUserInput() {
var autoCompleteInput = document.getElementById('auto-complete-input');
window.autoComplt.enable(autoCompleteInput, {
hintsFetcher: function (text, openAutocompleteList) {
$.ajax({
url: '/getautocompletelist',
type: 'post',
data: { search: text },
dataType: 'json',
@sycue
sycue / queue.php
Created October 23, 2013 08:22
PHP5 in Practice  (U.S.)Elliott III & Jonathan D.Eisenhamer
<?php
// A library to implement queues in PHP via arrays
// The Initialize function creates a new queue:
function &queue_initialize() {
// In this case, just return a new array
$new = array();
return $new;
}
// The destroy function will get rid of a queue
function queue_destroy(&$queue) {
@sallar
sallar / console-example.php
Created March 27, 2013 19:44
PHP Colored CLI Output Script.
<?php
// Output screenshot:
// http://cl.ly/NsqF
// -------------------------------------------------------
include_once 'console.php';
// ::log method usage
// -------------------------------------------------------
Console::log('Im Red!', 'red');
@kaizhu256
kaizhu256 / gist:4482069
Last active October 20, 2021 16:25
javascript - very fast and simple uuid4 generator benchmarked on http://jsperf.com/uuid4/8
/*jslint bitwise: true, indent: 2, nomen: true, regexp: true, stupid: true*/
(function () {
'use strict';
var exports = {};
exports.uuid4 = function () {
//// return uuid of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
var uuid = '', ii;
for (ii = 0; ii < 32; ii += 1) {
@jdiamond
jdiamond / indexeddb.html
Created September 16, 2012 22:25
IndexedDB Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IndexedDB Example</title>
</head>
<body>
<h1>IndexedDB Example</h1>
<p>