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 | |
| /** | |
| * Finds weeks by two dates | |
| * @param $startDate | |
| * @param $endDate | |
| * @return array | |
| */ | |
| public static function findWeeksBetweenTwoDates($startDate, $endDate) | |
| { |
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
| function Twins($a, $b) { | |
| $flag = false; | |
| $a_len = count($a); | |
| $b_len = count($b); | |
| if($a_len != $b_len) { | |
| throw new Exception('array index count mismatched!'); | |
| } | |
| $result = []; | |
| for($i = 0; $i<$a_len; $i++) { |
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 | |
| /** | |
| * Checks if string contains a domain name | |
| * @param $string | |
| * @return false|int | |
| */ | |
| function checkIfContainsDomainName($string) | |
| { | |
| $pattern = '/(http[s]?\:\/\/)?(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}/'; |
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 | |
| namespace Tests\Unit; | |
| use Tests\TestCase; | |
| use Illuminate\Foundation\Testing\DatabaseMigrations; | |
| use Illuminate\Foundation\Testing\DatabaseTransactions; | |
| use App\Models\Notification\PushNotification; | |
| use App\Modules\Partner\Requests\CreatePushNotificationRequest; |
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
| gitter(){ | |
| git add $1 | |
| echo "Enter Your Git Commit"; | |
| read commitMessage | |
| git commit -m "$commitMessage" | |
| echo "Enter Your Branch" | |
| read branch |
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 | |
| namespace App\Models\Campaign; | |
| use Illuminate\Database\Eloquent\Model; | |
| use App\Classes\Traits\SetModelConnectionToSlave; | |
| class CampaignDiscount extends Model | |
| { | |
| use SetModelConnectionToSlave { |
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
| let tempTimeStamp = 0; | |
| window.addEventListener('scroll', function (event) { | |
| if(((event["timeStamp"] - tempTimeStamp) / 1000) < 5){ //how many seconds you rely on. | |
| tempTimeStamp = event["timeStamp"]; | |
| }else{ | |
| console.log(( event["timeStamp"] - tempTimeStamp) / 1000) | |
| tempTimeStamp = event["timeStamp"]; | |
| //use withinviewport in here. | |
| } |
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
| //you can go to Manage Jenkins > Script Console | |
| import jenkins.model.Jenkins | |
| import hudson.model.Job | |
| MAX_BUILDS = 55 | |
| Jenkins.instance.getAllItems(Job.class).each { job -> | |
| println job.name | |
| def recent = job.builds.limit(MAX_BUILDS) | |
| for (build in job.builds) { |
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
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "sync" | |
| "time" | |
| ) | |
| func ping(w http.ResponseWriter, r *http.Request) { |