Skip to content

Instantly share code, notes, and snippets.

Kana naneri

  • Bishkek
Block or report user

Report or block naneri

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
naneri /
Created Sep 2, 2018
Add a new line to hosts
echo chef-automate.test | sudo tee -a /etc/hosts
naneri / laravel.js
Created May 1, 2018
The delete button with my own csrf_token
View laravel.js
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{ csrf_token() }}" data-confirm="Are you sure?">
(function() {
naneri /
Last active Dec 21, 2018
My bash cheatsheet
# ==========
# Laravel
# ==========
# Laravel folder permissions
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
# ==========
echo -e "$Cyan \n Updating System.. $Color_Off"
sudo apt-get update -y && sudo apt-get upgrade -y
echo -e "$Cyan \n Installing Apache2 $Color_Off"
sudo apt-get install apache2
naneri / query.sql
Created May 20, 2017
$fLat is the searchers latitude and $fLon the searchers longitude.
View query.sql
ACOS( SIN( RADIANS( `latitude` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `latitude` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `longitude` ) - RADIANS( $fLon )) ) * 6380 < 10
View select.blade.php
<select name="metrics_reminder" class="form-control list-group-item" required>
<option value="never" @if(old('course_reminder', $user->metrics_reminder) == 'never') selected @endif>Never</option>
@foreach(config('anya.metrics_reminder_intervals') as $value)
<option value="{{$value}}" @if(old('course_reminder', $user->metrics_reminder) == $value) selected @endif>
Once in {{$value}} days
naneri /
Last active Jul 29, 2016
Adds ssh identity to a server
cat ~/.ssh/ | ssh user@ "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
naneri / drop.php
Created Jul 17, 2016
Drop all tables in Laravel
View drop.php
foreach(\DB::select('SHOW TABLES') as $table) {
$table_array = get_object_vars($table);
naneri /
Created Feb 23, 2016
Laravel tricks

Adding seed data to migrations.

It often happens that you need some data to be available inside a migration. But the same data might be required in a Seeder (if you want to run it on test environtment). To make the data available for both in Seeder and Migration - you can simply call it inside a migration. Like that:

$seeder = new YourClassSeeder();

But you have to check inside the seeder file if the data is already available for your App, (so that you would not end up with two sets of the same data, after calling both migrations and seeders in testing machine).

naneri / disable_global.sql
Last active Jan 27, 2016
Disable foreign key checks
View disable_global.sql
You can’t perform that action at this time.