Skip to content

Instantly share code, notes, and snippets.

View andri-sudarmawijaya's full-sized avatar

Andri Sudarmawijaya andri-sudarmawijaya

View GitHub Profile
@andri-sudarmawijaya
andri-sudarmawijaya / desa_koordinat.php
Created March 7, 2020 15:41 — forked from nim4n136/desa_koordinat.php
Cara mendapatkan koordinat / longitude latitude Desa wilayah indonesia dengan openstreetmap dengan php
<?php
$wilayah = [
// nama desa
'desa' => "Sukaluyu",
// nama kecamatan
'kecamatan' => "Tamansari",
// nama kabupaten
'kab_kota' => "Bogor",
// nama provinsi
@andri-sudarmawijaya
andri-sudarmawijaya / seed_derivatives.drush.inc
Created January 14, 2020 00:06 — forked from jimconte/seed_derivatives.drush.inc
This script can generate image derivatives for Drupal for warming up the filesystem prior to going live. Image derivative generation puts an amount of load on the servers so it images have been migrated from another server with no derivatives, it may be useful to pre-generate using this script.
<?php
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\Condition;
use Drupal\image\Entity\ImageStyle;
use Drupal\file\Entity\File;
/**
* ================================================================
* Implements hook_drush_command().
* ----------------------------------------------------------------
@andri-sudarmawijaya
andri-sudarmawijaya / directprinting.php
Created October 28, 2019 06:30 — forked from anestan/directprinting.php
direct printing php dot matrix
<?php
//set printing option to raw
$tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file.
$file = tempnam($tmpdir, 'ctk'); # nama file temporary yang akan dicetak
$handle = fopen($file, 'w');
$condensed = Chr(27) . Chr(33) . Chr(4);
$bold1 = Chr(27) . Chr(69);
$bold0 = Chr(27) . Chr(70);
$initialized = chr(27).chr(64);
~~~
apt-get -y install php7.0-opcache php7.0-fpm php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-pgsql php7.0-imap php7.0-cli php7.0-cgi php-pear php-auth php7.0-mcrypt mcrypt imagemagick libruby php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl memcached php-memcache php-imagick php-gettext php7.0-zip php7.0-mbstring
~~~
#!/bin/sh
$ sudo chown -R USER:www-data storage/logs
$ sudo chmod -R ug+rw storage/logs
$ sudo chown -R USER:www-data storage/framework
$ sudo chmod -R ug+rw storage/framework
$ sudo chown -R USER:www-data bootstrap/cache/
$ sudo chmod -R ug+rw bootstrap/cache/
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
export LANGUAGE=en_US.UTF-8 \
export LC_ALL=en_US.UTF-8 \
export LANG=en_US.UTF-8 \
export LC_TYPE=en_US.UTF-8
~~~
---------------------------------------------------------------------------------------------------------------------------------+
| users | CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`role_id` int(10) unsigned DEFAULT NULL,
`remember_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
~~~
$table->unique(['product_id', 'company_id', 'price', 'delivery_hours'],
'prices_history_index_unique');
~~~
@andri-sudarmawijaya
andri-sudarmawijaya / php artisan tinker - create user
Created March 8, 2018 03:25
php artisan tinker - create user
~~~
>>> $user = New App\User;
=> App\User {#812}
>>> $user->name = 'admin';
=> "admin"
>>> $user->email='admin@example.com';
=> "admin@dev.bantenprov.go.id"
>>> $user->password = Hash::make('admin');
=> "$1"
>>> $user->save();