This file contains 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
function getSearchResult($keyword){ | |
$subject = file_get_contents("http://www.google.com/search?q=".urlencode($keyword)); | |
$href_pattern = '/<h3 class="r">(.*?)<\/h3>/s'; | |
preg_match_all($href_pattern, $subject, $matches); | |
foreach ($matches[0] as $key => $match) { | |
$replacment_pattern = '/href="([^"]+)"/'; |
This file contains 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 App\Acme\Box; | |
use App\Cases; | |
use App\Complaint; | |
use App\User; | |
use App\UserMeta; | |
use Illuminate\Foundation\Testing\WithoutMiddleware; | |
use Illuminate\Foundation\Testing\DatabaseMigrations; | |
use Illuminate\Foundation\Testing\DatabaseTransactions; |
This file contains 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
"niklasravnsborg/laravel-pdf": "^1.5" | |
$response = view("print.letter", compact("products", "date", "attachment_files", "letter_number", "content"))->render(); | |
$pdf = new Pdf($response, | |
['format' => 'A4','custom_font_path' => base_path('public'), // don't forget the trailing slash! | |
'custom_font_data' => [ | |
'IRANSans' => [ | |
'R' => 'IRANSans-Bold-web.ttf', // regular font | |
'B' => 'IRANSans-Bold-web.ttf', // optional: bold font | |
'I' => 'IRANSans-Bold-web.ttf', // optional: italic font |
This file contains 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.json{ | |
{ | |
"devDependencies": { | |
"gulp": "^3.8.8", | |
"laravel-elixir": "^6.0.0-15", | |
"laravel-elixir-vueify": "^1.0.0", | |
"laravel-elixir-webpack-official": "^1.0.10" | |
}, | |
"browser": { | |
"vue": "vue/dist/vue.common.js" |
This file contains 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
function in_array_r($needle, $haystack, $strict = false) { | |
// iterate over all items | |
foreach ($haystack as $key => $item) { | |
// check if the item is array, if so then call recursive function | |
if (is_array($item)){ | |
$ret = in_array_r($needle, $item, $strict); | |
if( is_array($ret) ) | |
return $ret; |
This file contains 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
function translateToWords($number) | |
{ | |
/***** | |
* A recursive function to turn digits into words | |
* Numbers must be integers from -999,999,999,999 to 999,999,999,999 inclussive. | |
* | |
* (C) 2010 Peter Ajtai | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or |
This file contains 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
server { | |
listen 185.13.231.188:500; | |
root /home/ftp_users/ftp/demo_core/public; | |
index index.php index.html index.htm; | |
server_name test.com; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} |
This file contains 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
#!/bin/bash | |
# Basic configuration: datestamp e.g. YYYYMMDD | |
DATE=$(date +"%Y%m%d") | |
# Location of your backups (create the directory first!) | |
BACKUP_DIR="/home/backup/database" |
This file contains 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
function getBranch($belief_id){ | |
$con = DBINT::DBCon(); | |
$qry = "SELECT branch.idbranch, branch.branchname from worldviews inner join branch on branch.idbranch = worldviews.branchid where beliefid = ".$belief_id.' group by branchid'; | |
$stmt = $con->prepare($qry); | |
$stmt->execute(); | |
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC); | |
$r = $stmt->fetchAll(); | |
$con = null; |
This file contains 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
$this->notificationService($device->device_token, $notification['target_screen'], $message['body'], $message['title']); | |
function notificationService($token, $targetScreen, $body = "", $title = "") | |
{ | |
$optionBuilder = new OptionsBuilder(); | |
$optionBuilder->setTimeToLive(60 * 20); | |
$optionBuilder->setCollapseKey('type_a'); | |
$optionBuilder->setContentAvailable(true); | |
try { | |
$optionBuilder->setPriority(OptionsPriorities::high); |
OlderNewer