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 main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func main() { | |
var recursiveAnonymous func(i int) | |
recursiveAnonymous = func(i int) { |
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
ps aux --sort -rss | head -n5 |
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
.leaflet-div-icon { | |
background: transparent; | |
border: none; | |
} | |
.leaflet-marker-icon .number{ | |
position: relative; | |
top: -37px; | |
font-size: 12px; | |
width: 25px; |
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
# Setup | |
git config git-ftp.url "ftp://ftp.example.net:21/public_html" | |
git config git-ftp.user "ftp-user" | |
git config git-ftp.password "secr3t" | |
# Upload all files | |
git ftp init | |
# Or if the files are already there | |
git ftp catchup |
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 | |
public function workDay() | |
{ | |
$aDates = []; | |
$aDateRanges = \Carbon\CarbonPeriod::create('2020-01-01', '2020-01-23'); | |
foreach ($aDateRanges->toArray() as $date) { | |
$aDates[] = $date->format('Y-m-d'); | |
} |
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 | |
function transform_tree($categories) { | |
$data = []; | |
foreach($categories as $key => $category) { | |
$data[$key] = [ | |
'name' = $category->name | |
]; | |
if ($category->children) { |
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 | |
public function statusPerYear(string $year) : array | |
{ | |
$query = " | |
select DATE_FORMAT(end_date, '%b-%y') month, | |
sum(CASE WHEN status = 4 THEN 1 ELSE 0 END) ongoing, | |
sum(CASE WHEN status = 8 THEN 1 ELSE 0 END) success, | |
sum(CASE WHEN status = 6 THEN 1 ELSE 0 END) failed, | |
sum(CASE WHEN status = 10 THEN 1 ELSE 0 END) cancel | |
from |
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
SELECT DATE_FORMAT(merge_date,'%m-%Y') AS month FROM ( | |
SELECT '2015-01-01' AS merge_date | |
UNION SELECT '2015-02-01' AS merge_date | |
UNION SELECT '2015-03-01' AS merge_date | |
UNION SELECT '2015-04-01' AS merge_date | |
UNION SELECT '2015-05-01' AS merge_date | |
UNION SELECT '2015-06-01' AS merge_date | |
UNION SELECT '2015-07-01' AS merge_date | |
UNION SELECT '2015-08-01' AS merge_date | |
UNION SELECT '2015-09-01' AS merge_date |
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
pm2 start artisan --name laravel-worker --interpreter php -- queue:work --daemon |
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 | |
// model student | |
class Student extends Model | |
{ | |
} | |
// user oberserver | |
class UserObserver | |
{ |
NewerOlder