Skip to content

Instantly share code, notes, and snippets.

View ivankravchenko's full-sized avatar
🐌
moving fast

Ivan Kravchenko ivankravchenko

🐌
moving fast
View GitHub Profile
#!/bin/bash
APP=$1
hk create -r eu $APP-static-se7ensky
hk set -a $APP-static-se7ensky BUILDPACK_URL=https://github.com/Se7enSky/heroku-buildpack-verstat.git
hk access-add -a $APP-static-se7ensky [email protected]
#!/bin/bash
set -e
if [ "$PHP_VERSION" == "" ]; then
echo "must set PHP_VERSION, i.e PHP_VERSION=5.5.14"
exit 1
fi
if [ "$UPLOAD_TO" == "" ]; then
#!/bin/bash
set -e
if [ "$NGINX_VERSION" == "" ]; then
echo "must set NGINX_VERSION, i.e NGINX_VERSION=1.7.3"
exit 1
fi
if [ "$UPLOAD_TO" == "" ]; then
@ivankravchenko
ivankravchenko / wordpress-tr.php
Created July 21, 2014 09:31
wordpress translate helper
<?php
/*
* tr – translation helper
* examples:
* tr("Hello") -> "Привіт" // simply translates given string
* tr("%s products", $category) -> "Продукти категорії " // translates format and uses sprintf for substitutions
* tr(array("%d comment", "%d comments"), $commentCount) -> "1 comment" // pluralized format version
*/
function tr() {
#!/bin/bash
URLS_FILE=$1
while read URL; do
TIME=`curl --silent -w '%{time_total}' -o /dev/null $URL`
echo "${TIME}s $URL"
done <$URLS_FILE
<?php
error_reporting(E_NONE);
$cnt = 100;
$t1 = microtime(true);
$a = 4;
for ($i=1; $i<=$cnt; $i++) { if ($a) { 1+1; } }
$t2 = microtime(true);
unset($a);
for ($i=1; $i<=$cnt; $i++) { if ($a) { 1+1; } }
@ivankravchenko
ivankravchenko / gist:1a57402a960e63d005d5
Created August 13, 2014 21:30
flynn error log samples
{"s":1,"t":1407963842576,"m":"[etcd] Aug 13 21:04:02.575 INFO | Discovery via https://discovery.etcd.io using prefix /[cut].\n"}
{"s":1,"t":1407963842975,"m":"[etcd] Aug 13 21:04:02.975 WARNING | Discovery encountered an error: Discovery found an initialized cluster but no reachable peers are registered.\n"}
{"s":1,"t":1407963842975,"m":"[etcd] Aug 13 21:04:02.975 WARNING | \u003cno value\u003e failed to connect discovery service[https://discovery.etcd.io/[cut]] Discovery found an initialized cluster but no reachable peers are registered.\n[etcd] Aug 13 21:04:02.975 CRITICAL | \u003cno value\u003e, the new instance, must register itself to discovery service as required\n"}
[
{
id: "burger-grill-bbq",
category: "Бургеры",
title: "Бургер с грилловаными овощами с соусом BBQ",
thumb: "http://placehold.it/350x260",
price: 28,
weight: 128,
nutrition: ['бургер', 'гриллованые овощи', 'соус BBQ', 'дизайн', 'верстка'],
addables: ['cheeses', 'cutlet']
@ivankravchenko
ivankravchenko / Procfile.dev-verstat
Created January 19, 2015 16:02
Procfile.dev-verstat and verstat2wp.sh
web: vendor/bin/heroku-php-nginx -C app_nginx.conf -F app_php-fpm.conf app
verstat: cd verstat ; npm install ; verstat --exec-after-generate 'cd .. ; ./verstat2wp.sh' serve
<!-- http://htmlbook.ru -->
<!-- Sublime Text 3 -->
<html>
<head>
<meta charset="utf8">
<title>Moneycalc</title>
<style>
* {