This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Singleton Class | |
class SumSingleton | |
{ | |
private static $instance; | |
private $result; | |
private function __construct() {} | |
public static function getInstance() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fyne.io/fyne/v2/data/binding" | |
"log" | |
) | |
type MySprintfString struct { | |
binding.String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use feature ':5.10'; | |
use local::lib; | |
use Carp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c:\laragon\www\backpack\database\seeds (master) | |
λ cat DatabaseSeeder.php Cities.php | |
<?php | |
use Illuminate\Database\Seeder; | |
class DatabaseSeeder extends Seeder | |
{ | |
/** | |
* Run the database seeds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
/** | |
* The application's route middleware. | |
* | |
* These middleware may be assigned to groups or used individually. | |
* | |
* @var array | |
*/ | |
protected $routeMiddleware = [ | |
'auth' => \Illuminate\Auth\Middleware\Authenticate::class, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window._ = require('lodash'); | |
/** | |
* We'll load jQuery and the Bootstrap jQuery plugin which provides support | |
* for JavaScript based Bootstrap features such as modals and tabs. This | |
* code may be modified to fit the specific needs of your application. | |
*/ | |
// This sticks jquery onto the window object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
// There is a field called 'new_password' which is left EMPTY if the password is not meant to be changed. | |
// WARNING: ONLY do this if you understand the implications of users (probably administrators) knowing | |
// other users' passwords; a more secure suggestion would be to force a password reset! | |
public function update(UpdateRequest $request) | |
{ | |
DB::transaction(function() use ($request, &$redirect_location) { | |
// your additional operations before save here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
public function rules() | |
{ | |
// I've only done the 'email' rule because I'm lazy! | |
return [ | |
'email' => [ | |
'required', 'email', 'max:255', Rule::unique->ignore($this->id), | |
], | |
]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
<?php | |
namespace App\Http\Controllers\Admin; | |
use Backpack\CRUD\app\Http\Controllers\CrudController; | |
// VALIDATION: change the requests to match your own file names if you need form validation | |
use App\Http\Requests\MytestRequest as StoreRequest; |