Skip to content

Instantly share code, notes, and snippets.

View tilhom's full-sized avatar
😎
On vacation

Ilyos Xizr tilhom

😎
On vacation
  • Uzbekistan, Tashkent
View GitHub Profile
@tilhom
tilhom / gist:574fccd6b64419dbeba2efc68c4e8e3c
Created November 4, 2018 15:08
Jquery o'ranish andozasi
<!DOCTYPE html>
<html>
<head>
<title>jQuery Crash Course | Selectors</title>
<style>
body{
font-size: 17px;
font-family: arial;
background: #f4f4f4;
line-height: 1.5em;
@tilhom
tilhom / gist:dd2f0bd4094559811d116c906d4c9970
Created November 4, 2018 15:59
Jquery events mavzusiga oid andoza
<!DOCTYPE html>
<html>
<head>
<title>jQuery Crash Course | Events</title>
<style>
body{
font-size: 17px;
font-family: arial;
background: #f4f4f4;
line-height: 1.5em;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="../dist/css/bootstrap.min.css">
<style>
body {
padding: 40px;
}
function submitAnswers() {
var score = 0, total = 5;
var q1 = document.forms["quizForm"]["q1"].value;
var q2 = document.forms["quizForm"]["q2"].value;
var q3 = document.forms["quizForm"]["q3"].value;
var q4 = document.forms["quizForm"]["q4"].value;
var q5 = document.forms["quizForm"]["q5"].value;
console.log(q1,q2,q3,q4,q5);
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v
<!DOCTYPE html>
<html>
<head>
<title>jQuery Crash Course | DOM Manipulation</title>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<style>
body{
font-size: 17px;
font-family: arial;
background: #f4f4f4;
@tilhom
tilhom / gist:eef1b6566afd4c958222432249632fcf
Last active November 17, 2018 06:47
Рекурсивное отображение категорий
function getCategories($categories, &$result, $parent_id = 0, $depth = 0)
{
//filter only categories under current "parent"
$cats = $categories->filter(function ($item) use ($parent_id) {
return $item->parent_id == $parent_id;
});
//loop through them
foreach ($cats as $cat)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>For</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>Hello loops!</h1>
$categories = Categories::whereHas('products', function ($query) use ($searchString){
$query->where('name', 'like', '%'.$searchString.'%');
})
->with(['products' => function($query) use ($searchString){
$query->where('name', 'like', '%'.$searchString.'%');
}])->get();
foreach($categories as $category){
echo $category->name . ':' . PHP_EOL;
foreach($category->products as $product){
<!DOCTYPE html>
<html>
<head>
<title>jQuery Crash Course | Selectors</title>
<style>
body{
font-size: 17px;
font-family: arial;
background: #f4f4f4;
line-height: 1.5em;