Skip to content

Instantly share code, notes, and snippets.

<?php
$code = '[code]hi i code![/code] [/code][/code]sad[code] asd [/code] [code]dss';
function c($text){
$pos1 = -1;
$pos2 = -1;
// потрібно щоб запустити while
$text = ' '.$text;
program lesya_polidrom;
uses math, SysUtils;
var s:string;
fl :boolean;
var pows:integer;
var iten:integer;
procedure pal(s:string; var fl:boolean);
<?php
for($i=1;$i<100;$i++) {
$powNum = pow($i, 2);
if(strlen($powNum) / 2 > 0){
$powNumLength = strlen($powNum) / 2;
} else {
$powNumLength = 1;
<html>
<head>
<meta property="og:locale" content="de_DE" />
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:title" content="Beef steak" />
</head>
<body>
Dog go to the shop
data = [
{id: 1, name: 'firstFolder', parent_id: null, type: 0},
{id: 2, name: 'secondFolder', parent_id: 1, type: 0},
{id: 3, name: 'thirdFolder', parent_id: 1, type: 0},
{id: 4, name: 'fourthFolder', parent_id: 2, type: 0},
{id: 5, name: 'fifthFolder', parent_id: 3, type: 0},
];
// data2 = [
// {id: 1, name: 'firstFolder', parent_id: null, type: 0},
// child.count is 4
// manChilds.count is 2
sheriph and prisoner go
sheriph go back
sheriph and manChilds go
sheriph and prisoner go back
// child.manChild.count is 1
man and manChild go
man go back
// child.girlChild.count is 2
@vitalii-komenda
vitalii-komenda / throttle.js
Last active May 6, 2018 01:34
Throttle helps to save performance, because it reduces number of calls
// It can be used to save input values after change
// $('input').on('change', throttle(function(){
// $.ajax(url);
//}, 1000))
function throttle(fn, time) {
return function inner() {
var args = Array.prototype.slice.call(arguments);
clearTimeout(inner.timeout);
inner.timeout = setTimeout(function () {
@vitalii-komenda
vitalii-komenda / ReloadCatcher.js
Created March 31, 2015 15:42
Catches links and forms from reloading a page. Inserts html data into specific container
(function ($, namespace) {
function ReloadCatcher(container) {
var self = this;
self.isItHtmlResponse = function (xhr) {
return xhr.getResponseHeader('Content-Type').indexOf('html') !== -1;
};
self.convertSubmitToAjaxCalls = function () {
@vitalii-komenda
vitalii-komenda / convertInputStringToJson.js
Created September 18, 2015 18:13
It converts string like "parents[child[bla]]" into json
function convertInputStringToJson(inputName){
var r = inputName.replace(/]/g, '').split('[');
var v = {};
var lastEl = null;
for(var i=0; i<r.length; i++) {
if(!Object.keys(v).length){
v[r[i]] = {};
lastEl = v[r[i]];
} else {
lastEl[r[i]] = {};
@vitalii-komenda
vitalii-komenda / countries.txt
Last active July 16, 2016 09:29
Twilio supported countries
Afghanistan  (+93)
Albania  (+355)
Algeria  (+213)
American Samoa  (+1684)
Andorra  (+376)
Angola  (+244)
Anguilla  (+1264)
Antigua and Barbuda  (+1268)
Argentina  (+54)
Armenia  (+374)