Skip to content

Instantly share code, notes, and snippets.

View mir4a's full-sized avatar
🤞

Myroslav mir4a

🤞
View GitHub Profile
@mir4a
mir4a / batch rename terminal
Created September 13, 2013 15:13
Batch rename file extensions (bash)
for i in *.ext; do mv -- "$i" "${i%.ext}.otherext"; done
@mir4a
mir4a / KIA PARSER
Last active December 18, 2015 14:09
очередной букмарклет парсер, но уже для kia.ua
javascript:
/**
* простой букмарклет, который парсит фотки из http://www.kia.ua/
*/
(function () {
var a = document.querySelectorAll("#thumbs .thumbs .thumb");
var docHeight = document.height;
/**
* Создаю фон прелоадера
* @type {*}
@mir4a
mir4a / geolocation
Created June 12, 2013 10:41
Поиск города по ширине и долготе (из navigator.geolocation) через гугл-карты. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
geocoder = new google.maps.Geocoder();
function codeLatLng(latlng) {
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
var city = results[1]["address_components"][2]["short_name"];
var setPhone;
@mir4a
mir4a / photo-parser
Created June 7, 2013 14:20
Парсилка картинок
javascript:
/**
* простой букмарклет, который парсит фотки из http://www.kia-motors.com.ua/
*/
(function () {
var a = document.querySelectorAll(".galleryContainer > a");
var docHeight = document.height;
/**
* Создаю фон прелоадера
* @type {*}
@mir4a
mir4a / bookmarklet.js
Created May 28, 2013 14:37
Simple street parser from http://mosopen.ru/
javascript:
/**
* простой букмарклет, который парсит улицы из http://mosopen.ru/
*/
(function () {
var txt = "[";
var a = document.querySelectorAll(".double_part li > a");
for (var i=0;i<a.length;i++) {
var t = a[i].innerText;
txt += '"'+t+'",';
@mir4a
mir4a / text_03.html
Last active December 16, 2015 14:49
regexp to format simple text to html tags in jetbrains
<!-- string to find -->
(^[а-яА-ЯёЁ a-zA-Z,. - -:;]+)
<!-- string to replace -->
<p>$1</p>
@mir4a
mir4a / load.php
Created April 11, 2013 06:40
gettin access to hipchat api
<?php
$token = "ADMIN_TOKEN"; // replace with your admin token
$url = "https://api.hipchat.com/v1/users/list?auth_token=".$token; // this url gets all users and their attributes, for more info visit https://www.hipchat.com/docs/api/
$c = curl_init();
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); // required this for https access
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); // this one too
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo curl_exec($c); // return json data
<!DOCTYPE html>
<html>
<head>
<style>
html {
width: 100%;
height: 100%;
}
body {
@mir4a
mir4a / style.less
Created April 9, 2013 11:01
Simple sticky footer with less
@footer_height: 100px;
body, html {
height: 100%;
}
.i-sticky {
min-height: 100%;
height: auto !important;
height: 100%;
@mir4a
mir4a / grid.css
Created April 5, 2013 13:29
Clear floating elements
/* `Clear Floated Elements
----------------------------------------------------------------------------------------------------*/
/* http://sonspring.com/journal/clearing-floats */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;