This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
// Обрабатывает клик на картинке | |
$('.img_block img').click(function() { | |
// Получаем адрес картинки |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = $_POST['upload_url']; | |
$file = new CURLFile(realpath('photo.jpg')); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, array( | |
'photo' => $file | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let name = 'Maria'; | |
let name2 = 'Vasilij'; | |
let age = 18; | |
let result = tag`My name ${name} sd sdc sdc and ${name2} and ${age}`; | |
function tag(srting,...values) { | |
return srting.reduce((prev,current,id) => { | |
if (id > 0) { | |
if (typeof values[id - 1] == 'string') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class DomainObjectAbstract | |
{ | |
protected $_id = null; | |
/** | |
* Get the ID of this object (unique to the | |
* object type) | |
* | |
* @return int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// для escape значений | |
function escapeHtml (string) { | |
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) { | |
return entityMap[s]; | |
}); | |
} | |
var entityMap = { | |
'&': '&', | |
'<': '<', | |
'>': '>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generates unique id (mix datetime and random). | |
* @param {number=} len Required length of id (16 by default). | |
* @returns {string} Generated id. | |
*/ | |
function genUID(len){ | |
function base36(val){ | |
return Math.round(val).toString(36); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"fmt" | |
"os" | |
"path/filepath" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"sort" | |
"strconv" | |
"strings" | |
"math" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Tree | |
{ | |
protected $nameChildAttribute = 'children'; | |
public function getTree(\Illuminate\Support\Collection &$tree, $nameMethod) : array | |
{ | |
foreach ($tree as &$parent) | |
{ |
OlderNewer