Skip to content

Instantly share code, notes, and snippets.

🏎️
Delivering

Levan Lotuashvili Lotuashvili

🏎️
Delivering
Block or report user

Report or block Lotuashvili

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
@Lotuashvili
Lotuashvili / Filter.php
Last active Mar 21, 2017
Filter Youtube link to parse only video ID (for embedding in website)
View Filter.php
<?php
funtion parseYoutubeVideoID($link) {
preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $link, $matches);
return $matches[1];
}
@Lotuashvili
Lotuashvili / routes.php
Last active Mar 21, 2017
Laravel subdomain routing
View routes.php
<?php
$host_array = array_reverse(explode('.', parse_url(url())['host']));
$domain = $host_array[1];
$tld = $host_array[0];
$host = $domain . '.' . $tld;
Route::group(['domain' => '{sub}.' . $host], function () {
get('/', function($sub) {
return 'Subdomain: ' . $sub;
@Lotuashvili
Lotuashvili / date.php
Last active Aug 31, 2015
Georgian date convertor for Laravel 5. Ex.: 25 აპრ, 12 ოქტ 2015
View date.php
<?php
function localizedDate($datetime, $year = false, $lang = false)
{
$lng = ($lang == 'ge' || $lang == 'en') ? $lang : \Lang::getLocale();
$months = [
'ge' => [1 => 'იან', 2 => 'თებ', 3 => 'მარ', 4 => 'აპრ', 5 => 'მაის', 6 => 'ივნ', 7 => 'ივლ', 8 => 'აგვ', 9 => 'სექტ', 10 => 'ოქტ', 11 => 'ნოე', 12 => 'დეკ'],
'en' => [1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec'],
];
$timestamp = strtotime($datetime);
@Lotuashvili
Lotuashvili / sticky.coffee
Last active Aug 29, 2015
Sticky footer with Coffee
View sticky.coffee
$ ->
check = ->
$ '.wrapper, .footer-wrapper'
.removeAttr 'style'
doc = $(document).innerHeight()
wrapper = $('.wrapper').innerHeight()
if doc > wrapper
$ '.wrapper'
View index.html
<meta property="og:title" content="OG Title" />
<meta property="og:site_name" content="OG Site Name" />
<meta property="og:description" content="OG Description" />
<meta property="og:url" content="Site URL" />
<meta property="og:type" content="website" />
<meta property="og:image" content="Image URL" />
<meta property="fb:admins" content="Your Facebook ID" />
<meta property="fb:app_id" content="Facebook App ID" />
View gulpfile.coffee
autoprefixer = require 'gulp-autoprefixer'
coffee = require 'gulp-coffee'
gulp = require 'gulp'
gutil = require 'gulp-util'
ignore = require 'gulp-ignore'
minifycss = require 'gulp-minify-css'
notify = require 'gulp-notify'
plumber = require 'gulp-plumber'
rename = require 'gulp-rename'
stylus = require 'gulp-stylus'
@Lotuashvili
Lotuashvili / car.php
Created Apr 23, 2015
მანქანის სანომრე ნიშნების შესაძლო ვარიანტები
View car.php
<?php
$letters = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
$nums = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
];
$count = 0;
@Lotuashvili
Lotuashvili / check.coffee
Created Mar 25, 2015
Chech/Uncheck all checkboxes with coffeescript
View check.coffee
$('.list .checkAll').change ->
status = this.checked
boxes = $('.list input[type="checkbox"]:not(.checkAll)')
boxes.each (i, elem) =>
elem.checked = status
return
$('.list input[type="checkbox"]:not(.checkAll)').change ->
num = $('.list input[type="checkbox"]:not(.checkAll)').filter(':not(:checked)').length # shows not checked num
if num == 0
$('.list .checkAll')[0].checked = true
@Lotuashvili
Lotuashvili / index.html
Created Dec 18, 2014
Chrome extension (New tab automatically redirects to url)
View index.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Lotuashvili.me</title>
<meta http-equiv="refresh" content="0;URL='http://lotuashvili.me/'" />
</head>
<body>
</body>
</html>
@Lotuashvili
Lotuashvili / average.java
Created Dec 2, 2014
საშუალო არითმეტიკული (Java)
View average.java
import java.util.Scanner;
public class Average {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double total = 0, grade, average, roundedAverage;
int num, count = 0;
System.out.print("Sheiyvanet ricxvebis raodenoba: ");
num = input.nextInt();
You can’t perform that action at this time.