Skip to content

Instantly share code, notes, and snippets.

View iegorov's full-sized avatar

Ivan Egorov iegorov

View GitHub Profile
@iegorov
iegorov / html5 boilerplate
Created August 19, 2013 04:20
html5 boilerplate
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
@iegorov
iegorov / session storage
Created August 14, 2013 03:12
session storage
var sessionStorage;
$(function () {"use strict";
if (typeof sessionStorage === 'undefined') {
sessionStorage = (function () {
var data = window.top.name ? JSON.parse(window.top.name) : {};
return {
clear: function () {
data = {};
window.top.name = '';
},
@iegorov
iegorov / using_that
Created August 14, 2013 03:00
using that example
var add = function (a, b) {
return a + b;
};
var myObj = {value: 0,
increment: function (inc) {
this.value += typeof inc === 'number' ? inc : 1;
}
};
myObj.double = function () {
var that = this;
@iegorov
iegorov / no cache
Created August 12, 2013 11:02
no cache
header("Cache-Control: no-store, no-cache, max-age=0");
@iegorov
iegorov / new news
Created August 12, 2013 10:59
add new news
div.newsText#news007>(h3.center+p+div.hide[style="display: none;"]+a.newsBtn{Читать далее >>})
@iegorov
iegorov / change attrib
Created August 12, 2013 08:17
Снятие атрибутов для скрытых файлов
attrib -S -H d:\TEST\desktop.ini /S /D
@iegorov
iegorov / usergame.php
Created July 12, 2013 09:00
Get json using CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http');
// curl_setopt($ch, CURLOPT_FAILONERROR, 1);
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($ch);
curl_close($ch);
$num = json_decode($result);
/**
* Пространство имен клиентской части терминала платежной системы "Кассервис"
*/
var KASSERVISTERM = KASSERVISTERM || {};
KASSERVISTERM.namespace = function (ns_string) {"use strict";
var parts = ns_string.split('.'),
parent = KASSERVISTERM,
i;
@iegorov
iegorov / avScript.js
Created July 12, 2013 06:45
Образец ajax запроса (устаревший вариант).
var regUrl = "http://v3.kasservis.loc/busticket/availablevoyage?src=" + av.src + "&dest=" + av.dest + "&dt=" + av.dt + "&nTick=" + av.numTick;
$.ajax({
url: regUrl,
dataType: "json",
timeout: 120000,
error: function (xhr, textstate) {
var wrap = $("#main_wrapper");
if (textstate === "timeout") {
wrap.html("Время ожидания ответа от сервера истекло!<br/>Повторите повторите попытку позже.");
} else {