Skip to content

Instantly share code, notes, and snippets.

View fedir's full-sized avatar
🌤️
The sun is behind every cloud

Fedir RYKHTIK fedir

🌤️
The sun is behind every cloud
View GitHub Profile
@fedir
fedir / sortArrayOfObjects.js
Last active August 29, 2015 14:01
Sort an array of objects by a property
myObjects.sort(function(obj1, obj2) {return obj2.sorting - obj1.sorting});
@fedir
fedir / nginxProxy.rb
Last active August 29, 2015 14:02
Nginx configuration when used as proxy to Apache sites // ref. :: http://stackoverflow.com/a/15467555/634275
location / {
root /path/to/root/of/static/files;
try_files $uri $uri/ @apachesite;
expires max;
access_log off;
}
location @apachesite {
proxy_set_header X-Real-IP $remote_addr;
@fedir
fedir / implode.sql
Created June 10, 2014 09:25
Implode comumn of Ids into single row
SELECT CAST(GROUP_CONCAT(field SEPARATOR ',') AS CHAR) FROM table
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="TYPO3_jr">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@fedir
fedir / removeSvnLocks.sh
Last active August 29, 2015 14:02
Remove all svn locks in the project (pure Linux shell)
#!/bin/bash
# What do You think about such method, any risks ?
find trunk -name lock | grep ".svn" | xargs rm -f
@fedir
fedir / atomicHeart.livecodelab
Last active August 29, 2015 14:02
Atomic Heart of Mother (Pink Floyd)
// Go here : http://livecodelab.net/play/index.html, paste the code
scale 5
7 times ->
scale
background black
stroke red
noFill
strokeSize 0.3
3 times ->
rotate time/200000
@fedir
fedir / shellListHeaviest10.sh
Created June 20, 2014 14:59
List 10 heaviest files / directories in shell
du -hsx * | sort -rh | head -10
@fedir
fedir / debugOptionsHhvm.md
Created June 21, 2014 11:48
Debug options for HHVM

$ vim /etc/hhvm/php.ini

hhvm.mysql.typed_results = false
hhvm.log.level = Verbose
hhvm.log.no_silencer = true
hhvm.log.header = true
hhvm.log.injected_stackTrace = true
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191

hhvm.log.use_log_file = true

<?php
$o_flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
'Reward the user for actually doing something right today! <br /><i>&quot;Good boy!&quot;</i>',
'Everything is O.K!',
t3lib_FlashMessage::OK // Could be ERROR / WARNING / NOTICE / INFO
);
t3lib_FlashMessageQueue::addMessage($o_flashMessage);
moment(stringDate, 'YYYY-MM-DD'); // Analyze date
moment(stringDate, 'YYYY-MM-DD').format('X'); // format to Unixtimestamp
// Timezones handling
var newYork = moment.tz("2014-06-01 12:00", "America/New_York");
var london = newYork.clone().tz("Europe/London");