Skip to content

Instantly share code, notes, and snippets.

View saber13812002's full-sized avatar
💭
stackoverflow+codegrepper.com

Saber tabatabaee yazdi saber13812002

💭
stackoverflow+codegrepper.com
View GitHub Profile
@saber13812002
saber13812002 / README.md
Last active April 11, 2021 09:25
customize The add new item link in SharePoint

How can we create one to many relation by two or more lists in sharepoint

1- first you need two lists (please create them) neming: parent and child

2- in child list you need to have a look up field to ( to the parent column)

NOTE: PLEASE SELECT :ID field as extra field to your list

what we expected:

@saber13812002
saber13812002 / codemelli.cs
Last active December 6, 2020 10:43 — forked from ebraminio/gist:5292017
Check Iranian National Code Validity - بررسی صحت کد ملی ایرانی - Clojure, C#, Ruby, JavaScript, Python, Scala, Java 8, PHP, C, Go, Swift, Kotlin, Groovy, Rust, Haskell, Erlang, Elixir
// Check Iranian National Code Validity - Clojure, C#, Ruby, JavaScript, Python, Scala, Java 8, PHP, C, Go, Swift, Kotlin, Groovy, Rust, Haskell, Erlang, Elixir
// بررسی صحت کد ملی ایران - کلوژر، سی‌شارپ، روبی، جاوااسکریپت، پایتون، اسکالا، جاوا ۸، پی‌اچ‌پی، سی، گو، سوئیفت، کاتلین، گرووی، راست، هسکل، ارلنگ، الکسیر
// در نسخه‌های قبل یکسان بودن اعداد نا معتبر تشخیص داده می‌شد ولی
// اعداد یکسان نامعتبر نیست http://www.fardanews.com/fa/news/127747
// بعضی از پیاده‌سازی‌ها سریع نیستند، می‌توانید نسخهٔ خود را بر پایهٔ
// نسخهٔ سی یا گو ایجاد کنید که بهترین سرعت را داشته باشد
/**
@saber13812002
saber13812002 / gist:2f88cdb8bc75387ff5a698da7bc21ead
Created December 1, 2020 16:53
bouncer from child department
$user = Auth::user();
if ($user->can($ability, $modelOrItem)) {
return true;
}
$descendants = $user->departments()->with('descendants')->get();
foreach ($descendants as $descendant) {
if ($descendant->can($ability, $modelOrItem)) {
/**
* Set empty nullable fields to null
* @param object $model
*/
protected static function setNullables(object $model): void
{
foreach ($model->nullable as $field) {
if (empty($model->{$field})) {
$model->{$field} = null;
}
@saber13812002
saber13812002 / UserModel.php
Last active October 26, 2020 07:50
set all information of user or model to null after restore Laravel Setting null values only on certain fields
// BaseModel Class
protected $nullable = [];
/**
* Listen for save event
*/
protected static function boot()
{
parent::boot();
@saber13812002
saber13812002 / copy-checklist.js
Created October 2, 2020 08:15 — forked from niallsmart/copy-checklist.js
Copy Trello checklist to clipboard
copy($(".checklist-item:not(.checklist-item-checked)").map(function() {
var e = $(this),
item = e.find(".checklist-item-details-text").text()
if (e.hasClass("checklist-item-state-complete")) {
item = item + " (DONE)"
}
return item
}).get().join("\n"))
@saber13812002
saber13812002 / README.md
Created September 26, 2020 19:06 — forked from mul14/README.md
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
<script type="javascript">
$('#tabs').tabs('select', $('div[selected=true]').attr('nav-product-comments-tab'));
$(document).ready(function () {
console.log('d')
const urlParams = new URLSearchParams(window.location.search);
console.log(urlParams)
const activeTab = urlParams.get('active_tab');
console.log(activeTab)
@saber13812002
saber13812002 / gist:e87f59fbb4dde6e08135d24bfd67b27f
Created September 8, 2020 07:18
laravel persian numbers عدد اعداد فارسی برای لاراول
function persianNumber($englishNumber)
{
return str_replace(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'], $englishNumber);
}
@saber13812002
saber13812002 / grasshopper csharp only
Created August 17, 2020 06:30 — forked from texone/grasshopper csharp only
mesh based reaction diffusion
using System;
using System.Collections;
using System.Collections.Generic;
using Rhino;
using Rhino.Geometry;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;