Skip to content

Instantly share code, notes, and snippets.

View aleskiontherun's full-sized avatar

Aleksei Vesnin aleskiontherun

View GitHub Profile
@aleskiontherun
aleskiontherun / gist:0c5e0045ee6953b037c2
Created August 20, 2014 15:11
User timezone detection
<?php
// CLIENTSIDE:
if (!Yii::app()->user->timezone): ?>
<script type="text/javascript">
$(function () {
var visitortime = new Date();
$.ajax({
type: "GET",
@aleskiontherun
aleskiontherun / ryanair-expand-countries
Last active August 29, 2015 13:56
Log "country - cities" from Ryanair compact destination cities list
/**
* 1. Selct a city in the "From" field list
* 2. Open the "To" field list
*
* Some times there is a simple cities list without countries, which is very uncomfortable
* This gist is for those cases
*
* 3. Copy this code into your Firebug (or other) console and execute
*
* Don't forget to perform step 2 every time you select a new "From" city
@aleskiontherun
aleskiontherun / rrd-last-value
Last active August 11, 2020 06:20
Get a last value stored in rrd file within the rrdtool in CLI
rrdtool lastupdate /path/to.rrd | sed ':a;N;$!ba;s/.*: \([0-9]*\)/\1/g'

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@aleskiontherun
aleskiontherun / pinba_api_phpdoc.php
Last active December 18, 2015 14:19
A list of pinba functions with phpdoc
<?php
/**
* Creates and starts new timer.
* @param array $tags an array of tags and their values in the form of "tag" => "value". Cannot contain numeric indexes for obvious reasons.
* @param array $data optional array with user data, not sent to the server.
* @return resource Always returns new timer resource.
*/
function pinba_timer_start($tags, $data = array()){}
#!/usr/bin/env bash
RUBY_VERSION_MAJOR="2.1"
RUBY_VERSION="2.1.2"
apt-get -y update && apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/${RUBY_VERSION_MAJOR}/ruby-${RUBY_VERSION}.tar.gz
tar -xvzf ruby-${RUBY_VERSION}.tar.gz
cd ruby-${RUBY_VERSION} && ./configure --prefix=/usr/local && make && make install