Skip to content

Instantly share code, notes, and snippets.

Gurban Gurbanov BumbuKhan

Block or report user

Report or block BumbuKhan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BumbuKhan
BumbuKhan / Yii2
Created Jan 31, 2018
Yii2 turn off asset caching
View Yii2
'assetManager' => [
'class' => 'yii\web\AssetManager',
'forceCopy' => YII_DEBUG,
'appendTimestamp' => YII_DEBUG,
]
@BumbuKhan
BumbuKhan / linux-bash
Created Nov 29, 2017
How to create tar.gz archive in linux command line
View linux-bash
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
Here’s what those switches actually mean:
-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
-f: Allows you to specify the filename of the archive.
@BumbuKhan
BumbuKhan / .htaccess
Created Nov 17, 2017
.htaccess - redirect HTTP to HTTPS
View .htaccess
# BEGIN Force SSL
# This should be the first rule before other rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# END Force SSL
@BumbuKhan
BumbuKhan / distance_between.sql
Created Sep 19, 2017 — forked from esaounkine/distance_between.sql
Calculate distance between two points with MySQL
View distance_between.sql
CREATE FUNCTION distance_between (from_lat DECIMAL(6, 3), from_lng DECIMAL(6, 3), to_lat DECIMAL(6, 3), to_lng DECIMAL(6, 3)) RETURNS DECIMAL(11, 3)
RETURN 6371 * 2 * ATAN2(SQRT(POW(SIN(RADIANS(to_lat - from_lat)/2), 2) + POW(SIN(RADIANS(to_lng - from_lng)/2), 2) * COS(RADIANS(from_lat)) * COS(RADIANS(to_lat))), SQRT(1 - POW(SIN(RADIANS(to_lat - from_lat)/2), 2) + POW(SIN(RADIANS(to_lng - from_lng)/2), 2) * COS(RADIANS(from_lat)) * COS(RADIANS(to_lat))));
@BumbuKhan
BumbuKhan / flash-app.js
Created Aug 8, 2017 — forked from brianmacarthur/flash-app.js
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
View flash-app.js
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@BumbuKhan
BumbuKhan / ExpressJS
Created Jul 26, 2017
ExpressJS file upload
View ExpressJS
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './uploads/')
},
filename: function (req, file, cb) {
crypto.pseudoRandomBytes(16, function (err, raw) {
cb(null, raw.toString('hex') + Date.now() + '.' + mime.extension(file.mimetype));
});
}
});
@BumbuKhan
BumbuKhan / Cordova
Created Jul 9, 2017
config.xml keyboard issue solved
View Cordova
<?xml version="1.0" encoding="UTF-8"?>
<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.helloworld"
version = "2.5.0">
<name>UNDP</name>
@BumbuKhan
BumbuKhan / Cordova
Created Jun 27, 2017
Angular-cordova routing cure
View Cordova
<script>
var baseHref = window.location.href.split('/');
baseHref.pop();
document.write('<base href="' + baseHref.join('/') + '/" />');
</script>
@BumbuKhan
BumbuKhan / PosgreSQL
Created Apr 21, 2017
How to create extension for table
View PosgreSQL
CREATE EXTENSION citext; -- to create
ALTER TABLE <table name>
ALTER COLUMN <column_name> TYPE citext; -- to apply
@BumbuKhan
BumbuKhan / PostgreSQL
Created Apr 20, 2017
How to view command line history, bash?
You can’t perform that action at this time.