Skip to content

Instantly share code, notes, and snippets.

@ikawka
ikawka / nearby-coordinates.sql
Created October 9, 2022 03:17 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@ikawka
ikawka / git_plugin.md
Created December 14, 2021 07:54 — forked from ryanlindsey/git_plugin.md
Git plugin shortcuts for Oh My ZSH
Alias Command
g git
ga git add
gaa git add --all
gapa git add --patch
gb git branch
/*
* http://www.javascriptkit.com/dhtmltutors/sticky-hover-issue-solutions.shtml
* Method 3- Using CSS Media Queries Level 4 Interaction Media Features
*/
@media (hover:none),
(hover:on-demand) {
nav a:hover {
/* suppress hover effect on devices that don't support hover fully */
background: none;
@ikawka
ikawka / htmlentity.js
Created September 20, 2018 04:20 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
@ikawka
ikawka / docker-cleanup-resources.md
Created November 10, 2017 03:26 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@left-panel-width: 13em;
@right-panel-width: 13em;
.ui-panel {
width: @left-panel-width;
}
.ui-panel.ui-panel-position-right {
width: @right-panel-width;
}
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@ikawka
ikawka / config.inc.php
Created October 4, 2013 02:04 — forked from nodesocket/config.inc.php
phpMyAdmin Mod
<?php
$cfg['ShowPhpInfo'] = true;
$cfg['TitleTable'] = '@SERVER@ - @DATABASE@ - @TABLE@';
$cfg['TitleDatabase'] = '@SERVER@ - @DATABASE@';
$cfg['TitleServer'] = '@SERVER@';
$cfg['TitleDefault'] = '@SERVER@';
// 2 Hours Till Auto-Logout