Skip to content

Instantly share code, notes, and snippets.

View rolldone's full-sized avatar
🏠
Working from home

Donny Rolanda rolldone

🏠
Working from home
View GitHub Profile
Get a week from date
console.log(moment().isoWeekday()); // returns 1-7 where 1 is Monday and 7 is Sunday
@rolldone
rolldone / Laravel Jutsu
Last active April 28, 2020 07:52
Laravel Jutsu Collection and PHP
A simpler, secure solution for Laravel API token-based authentication tanpa jwt, passport
https://itnext.io/a-simpler-secure-solution-for-laravel-api-token-based-authentication-82b582272770
Set default progmramatic guard better for api
Auth::setDefaultDriver('api');
Mengetahui funngsi ini berasal dari override class
if(get_class() != get_called_class()){}
@rolldone
rolldone / Javascript define module pattern
Created February 26, 2020 03:37
Javascript jutsu pattern
# Simple passing data with require like this "require('package_name')(passRouter)"
module.export = function(router){
// Todo some code here
router.blablabla
}
@rolldone
rolldone / regex
Last active February 28, 2020 23:54
webpack test Regex cheat
.*[^a]$ = "kecuali a"
.*[a]$ = "harus a"
/^["filter"]{"length"}$/ = base regex
# Kedua kode ini harus ada dengan module yang berbeda
- Ambil keluarkan dari node_modules yang mengandung moment
/[\\/]node_modules[\\/]((moment|module_lain).*)[\\/]/
- Jangan mengambil yang mengandung moment
/[\\/]assets[\\/]((?!moment|module_lain).*)[\\/]/
@rolldone
rolldone / Function.Array-Group-By.php
Created March 17, 2020 04:13 — forked from mcaskill/Function.Array-Group-By.php
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
@rolldone
rolldone / git jutsu
Created March 19, 2020 08:29
Git jutsu
git mv -f OldFileNameCase newfilenamecase
@rolldone
rolldone / october_jutsu.md
Last active March 27, 2020 13:23
October Ninjutsu

Static Page Class

  • main class on Plugin get Current Page \RainLab\Pages\Classes\Page
$pageName = 'static-test' or what static name do you call;
$staticPage = StaticPage::load($this->controller->getTheme(), $pageName);
dd($staticPage->viewBag);
  • Get Parent $staticPage->getParent();
@rolldone
rolldone / readme.md
Created March 22, 2020 11:21 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

Salah di systemjs-importmap "Ingat import yang dist bukan yang di develop seperti src"

Uncaught SyntaxError: Cannot use import statement outside a module BaseRactive.js:1 Uncaught (in promise) SyntaxError: Cannot use import statement outside a module

@rolldone
rolldone / BaseRactive.js
Last active April 8, 2020 00:41
BaseRactive Helper CLass
import Ractive from "ractive";
import Config from "Config";
Ractive.debug = true;
Ractive.defaults.delimiters = ["[[", "]]"];
Ractive.defaults.tripleDelimiters = ["[[[", "]]]"];
Ractive.defaults.isolated = true;
window.componentsHash = {}; /* GLOBAL */
Ractive.defaults.oninit = function() {
if (this.get("ref")) window.componentsHash[this.get("ref")] = this;