Skip to content

Instantly share code, notes, and snippets.

View chernomyrdin's full-sized avatar

Andrey Chernomyrdin chernomyrdin

  • Saint-Petersburg
View GitHub Profile
@chernomyrdin
chernomyrdin / form.html
Created December 2, 2011 11:08
js form
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
body {
background-color: white;
}
form .field .red {
display: none;
@chernomyrdin
chernomyrdin / comments.html
Created November 30, 2011 07:32
Применение стилей для нескольких классов одного элемента
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Применение стилей для нескольких классов одного элемента</title>
<style type="text/css">
body {
background-color: white;
}
p {
@chernomyrdin
chernomyrdin / pqsaff.js
Created October 27, 2011 12:23
Parse query_string and fill form
function pqsaff () {
this.vars = (window.location.search.length > 1) ?
window.location.search.substring(1).split("&") :
[];
}
pqsaff.prototype = {
param: function (s) {
var p = s.split("=");
this.name = p.shift();
@chernomyrdin
chernomyrdin / read_bmp.pl
Created October 14, 2011 10:04
Read BMP file
#!/usr/bin/perl -w --
use strict;
use warnings;
use IO::File;
my %header;
my %bitmap;
my @palette;
my $fh = IO::File->new("_.bmp");
@chernomyrdin
chernomyrdin / mysql.pl
Created October 7, 2011 10:36
Sample perl/mysql code
#!/usr/bin/perl -w --
use warnings;
use strict;
use utf8;
package DoMysql;
use DBI;
@chernomyrdin
chernomyrdin / sample-phar.php
Created March 16, 2015 13:25
Make phar from laravel app
<?php
class UserFilter extends FilterIterator {
public function accept () {
$file = $this->getInnerIterator()->current();
$path = explode("/", $file, 3);
if (count($path) < 2 or !in_array($path[1], array('app','bootstrap','vendor'))) return FALSE;
elseif ("/." == substr($file, -2)) return FALSE;
elseif ("/.." == substr($file, -3)) return FALSE;
# echo $file, PHP_EOL;
@chernomyrdin
chernomyrdin / Replacer.php
Created May 27, 2014 14:30
Replace substring, append some string demo for preg_replace_callback
<?php
class Replacer {
private static $__instance;
private $regex = '';
private $append = '';
private $replace = array(
'ул' => 'улица',
'ш' => 'шоссе',
/**
* @output_file_name default.js
* @compilation_level ADVANCED_OPTIMIZATIONS
* @formatting pretty_print
*/
/**
* Sample location parameter access classs
*/