Skip to content

Instantly share code, notes, and snippets.

View Lotuashvili's full-sized avatar
🏎️
💨

Levan Lotuashvili Lotuashvili

🏎️
💨
View GitHub Profile
@Lotuashvili
Lotuashvili / Filter.php
Last active March 21, 2017 13:48
Filter Youtube link to parse only video ID (for embedding in website)
<?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 March 21, 2017 09:23
Laravel subdomain routing
<?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 August 31, 2015 14:05
Georgian date convertor for Laravel 5. Ex.: 25 აპრ, 12 ოქტ 2015
<?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 August 29, 2015 14:26
Sticky footer with Coffee
$ ->
check = ->
$ '.wrapper, .footer-wrapper'
.removeAttr 'style'
doc = $(document).innerHeight()
wrapper = $('.wrapper').innerHeight()
if doc > wrapper
$ '.wrapper'
@Lotuashvili
Lotuashvili / index.html
Last active October 5, 2020 20:22
OG Tags
<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" />
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 April 23, 2015 10:27
მანქანის სანომრე ნიშნების შესაძლო ვარიანტები
<?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 March 25, 2015 22:40
Chech/Uncheck all checkboxes with coffeescript
$('.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 December 18, 2014 21:28
Chrome extension (New tab automatically redirects to url)
<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 December 2, 2014 20:05
საშუალო არითმეტიკული (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();