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 | |
// this script would save csv file to this specified directory | |
// APPPATH is location of application folder in Codeigniter | |
$file = fopen(APPPATH . '/../upload/'.'tesaasasat.csv', 'wb'); | |
// set the column headers | |
fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5')); | |
// Sample data. This can be fetched from mysql too | |
$data = array( |
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 | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class BCAAPI extends MY_Controller { | |
function __construct(){ | |
$this->api_key = "YOUR API KEY"; | |
$this->api_secret = "YOUR API SECRET"; | |
$this->client_id = "YOUR CLIENT 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 | |
// Lets say , we want to send a direction request with guidance to Google Maps API using link below. | |
// https://maps.googleapis.com/maps/api/directions/json?origin=-6.190109,%20106.798565&destination=-6.177596,%20106.792611&key=USEYOUR_KEY | |
// some of request, especially in field html-instruction would return unicode html text like this one ('Head \u003cb\u003ewest\u003c/b\u003e'). | |
// for some reason, I just want to use the text provided there ('Head west'). | |
// after some googling and asking, here is the best code I have (right now) | |
# example response | |
//Type A : There are 2 sentence in one single direction response |
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
rem Close all cmd.exe | |
taskkill /F /IM cmd.exe /T | |
rem Delete temporary folder that contain "scope" in its name | |
FOR /D /R %dir% %%X IN (scope*) DO RMDIR /S /Q "%%X" |
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 | |
function round_up_to_nearest_n($int, $n) { | |
return ceil($int / $n) * $n; | |
} | |
//result will be 10100 | |
round_up_to_nearest(10001,100); | |
//result will be 100000 | |
round_up_to_nearest(85000,50000); |
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 | |
#October 3, 2017 | |
#First activate pdo_odbc in your server | |
#extension=php_pdo_odbc.dll | |
#then | |
#odbc.defaultbinmode=1 | |
#odbc.defaultlrl=4096 | |
#odbc.max_links=-1 |
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
#1 | |
$file = fopen('log_script.txt', 'a'); | |
fwrite($file, $error. "\n"); | |
fclose($file); | |
#2 | |
$file_log = 'log_script.txt'; | |
file_put_contents($file_log, $error."\n", FILE_APPEND | LOCK_EX); |
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
// FTP access parameters | |
$host = 'xxx'; | |
$usr = 'xxx'; | |
$pwd = 'xxx'; | |
// file to move: | |
// $local_file = 'D:/xampp/htdocs/absen_folder/log_script.txt'; | |
// $local_file = 'D:\xampp\htdocs\absen_folder\log_script.txt'; | |
$local_file = 'cek.txt'; | |
$ftp_path = 'derta.co.id/htdocs/tes_derta/'.date('Y-m-d').'/cek.txt'; |
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 | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateTableUsers extends Migration | |
{ | |
/** | |
* Run the migrations. |
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 | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class AdjustTicketsTable extends Migration | |
{ | |
/** | |
* Run the migrations. |
OlderNewer