Skip to content

Instantly share code, notes, and snippets.

Ivan obojdi

Block or report user

Report or block obojdi

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
@obojdi
obojdi / check_user.php
Created Aug 2, 2017
random username checker
View check_user.php
<?php
$dbh = ['user_10', 'user_02', 'user_05', 'user_08', 'user_07', 'user_06', 'user_09'];
$a = function ($un = '') use ($dbh, &$a){
$random_digit = sprintf("%02d", rand(0, 10));
$username_random = "user_" . $random_digit;
if(strlen($un)){
$username = $un;
}else{
$username = $username_random;
}
@obojdi
obojdi / imageUploader.php
Created Aug 1, 2017
Image uploader class
View imageUploader.php
<?php
/**
* Image uploader
*/
class ImageUploader
{
private $this;
private $id;
private $uploadPath;
public $updateId;
@obojdi
obojdi / script.js
Created Jun 30, 2017
lightningmaps.org restyling
View script.js
var a = setInterval(function() {
$('canvas').parent().addClass('canvas');
}, 1000)
View .zshrc
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
alias grep="/usr/bin/grep $GREP_OPTIONS"
unset GREP_OPTIONS
export CYGWIN="nodosfilewarning mintty detect_bloda"
echo -ne '\eP\e]10;#CCCCCC\a' # Foreground -> base0
echo -ne '\eP\e]11;#2D2D2D\a' # Background -> base03
echo -ne '\eP\e]12;#00AAFF\a' # Cursor -> red
@obojdi
obojdi / pepyaka_text.js
Created Aug 11, 2016
Пепячиватель текста
View pepyaka_text.js
//подставить в el DOM-селектор попячиваемого элемента
function pepyachka(el) {
if (typeof window.jQuery == "undefined") {
var g = document.createElement('script');
g.type = "text/javascript";
g.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js";
document.head.appendChild(g);
}
var
a = document.createElement('link'),
@obojdi
obojdi / .htaccess
Created Feb 4, 2015
apache standard conf
View .htaccess
DirectoryIndex index.php
ErrorDocument 404 /404/
RewriteEngine On
Options +FollowSymlinks
Options -Indexes -MultiViews
@obojdi
obojdi / ymaps_geo.js
Created Jan 13, 2015
Coordinates from string address
View ymaps_geo.js
$('.geocode').click(function(e){
e.preventDefault();
var address = $('[name="address"]').val();
console.log(address)
$.ajax(
{
url:'http://geocode-maps.yandex.ru/1.x/?format=json&geocode='+address
}
).success(function(data){
var resp = data.response.GeoObjectCollection.featureMember[0].GeoObject.Point.pos
@obojdi
obojdi / POST_dynamic_fields.php
Created Nov 6, 2014
Handle POST from dynamically added form fields
View POST_dynamic_fields.php
<div class="button insert">Добавить поле</div>
<form class="ui-filterable" method="POST">
<?
$sum=4;
for ($count=0; $count <$sum ; $count++)
{
?>
<input type="text" class="input text" name="preset[]" placeholder="text" value="preset text <?=$count?>"/>
<?}?>
<input class="button submit" type="submit">
@obojdi
obojdi / checkHeight.js
Created Sep 25, 2014
overlay popup with height breakpoint
View checkHeight.js
var breakpoint_1 = 800;
function checkHeight(){
var wh = $(window).height() || window.innerHeight || root.clientHeight || body.clientHeight ;
if (wh<=breakpoint_1){
$('html').addClass('smallscreen');
}else{
$('html').removeClass('smallscreen');
};
$('.popup').css('margin-left', $('.popup').width() / -2);
You can’t perform that action at this time.