Skip to content

Instantly share code, notes, and snippets.

@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 / git jutsu
Created March 19, 2020 08:29
Git jutsu
git mv -f OldFileNameCase newfilenamecase
@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 / 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 / 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 / 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()){}
Get a week from date
console.log(moment().isoWeekday()); // returns 1-7 where 1 is Monday and 7 is Sunday
var Original = {
extend : function(props = null) {
var newOne = Object.assign({}, this);
newOne.super = Object.assign({}, newOne);
if (props != null) {
for(var key in props){
if(props[key].toString().includes('.super') == false){
if(key != 'construct'){
console.log('key',key);
newOne.super[key] = props[key];
client list -> Melihat driver yang melakukan koneksi
info -> melihat isi penggunnaan redis
Jika pada saat create user namun tab autocomplete tidak jalan maka :
sudo chsh -s /bin/bash <username>
source :
https://askubuntu.com/questions/325807/arrow-keys-home-end-tab-complete-keys-not-working-in-shell