Skip to content

Instantly share code, notes, and snippets.

View agoalofalife's full-sized avatar
😉
Do what you can, with what you have, where you are

Ilya Chubarov agoalofalife

😉
Do what you can, with what you have, where you are
View GitHub Profile
<!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() {
// Получаем адрес картинки
@agoalofalife
agoalofalife / 0_reuse_code.js
Created May 10, 2016 12:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@agoalofalife
agoalofalife / php
Last active August 23, 2017 19:07
Curl отправки фото в vk api
$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
));
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') {
<?php
abstract class DomainObjectAbstract
{
protected $_id = null;
/**
* Get the ID of this object (unique to the
* object type)
*
* @return int
// для escape значений
function escapeHtml (string) {
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) {
return entityMap[s];
});
}
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
/**
* 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);
}
package main
import (
"log"
"fmt"
"os"
"path/filepath"
"strings"
)
@agoalofalife
agoalofalife / statistic.go
Last active April 19, 2017 09:13
statistic.go
package main
import (
"fmt"
"log"
"net/http"
"sort"
"strconv"
"strings"
"math"
<?php
trait Tree
{
protected $nameChildAttribute = 'children';
public function getTree(\Illuminate\Support\Collection &$tree, $nameMethod) : array
{
foreach ($tree as &$parent)
{