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 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 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 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 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 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 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
import { EventEmitter } from "events" | |
export class WaitGroup extends EventEmitter { | |
public state: number | |
constructor(initialState: number = 0) { | |
if (initialState < 0) { | |
throw new RangeError() | |
} | |
super() |
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" | |
"net/http" | |
"sync" | |
"time" | |
) | |
func ping(w http.ResponseWriter, r *http.Request) { |
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
find . -type f -not -path '*/\.*' -exec sed -i -e "s@<base href=\"\/\/www.mydomain.com.\"\/>@\/@" {} \; |
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 | |
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; |
OlderNewer