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 foobar | |
import ( | |
"github.com/xxx/xxx/internal/bazzer" // why not just "../bazzer"? | |
) |
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
// Existing solution (result not implementation) | |
const existingWay = theUrlConstructor([ '/api/v1/resource/{0}/{1}', 'my string, with unsafe', 'url +characters+' ]) | |
// /api/v1/resource/my%20string%2C%20with%20unsafe/url%20%2Bcharacters%2B | |
// New solution | |
const url = (strings, ...values) => { | |
return strings.reduce((compiled, string, index) => { | |
return compiled.concat(string, encodeURIComponent(values[index] || '')) | |
}, []).join('') | |
} |
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 Illuminate\Database\Capsule\Manager as Capsule; | |
//we register the triggers on this hook to ensure the functions and class is loaded without needing to check if the module is enabled. | |
add_hook('achievements/register_triggers', 1, function($achievements) { | |
$achievements->registerTrigger([ | |
'group' => 'forum',//the group this trigger belongs to | |
'name' => 'newtopic',//the name of this trigger (must be unique) | |
'description' => 'Creates Topic',//the text to us in the dropdown when an admin selects a trigger |
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
@extends('layout') | |
@section('title', $title) | |
@section('content') | |
<div id="domain" style="margin-top:20px;width: 100%;"> | |
<div class="mdl-card mdl-shadow--2dp"> | |
<div class="mdl-card__title mdl-card--expand" :style="{ backgroundImage: 'url(' + domain.screenshot + ')' }"> |
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\Events\Domains; | |
use App\Events\Event; | |
use App\Models\Domain; | |
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | |
use Illuminate\Queue\SerializesModels; | |
class ScreenshotUpdated extends Event implements ShouldBroadcast | |
{ |
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
var page = require('webpage').create(), | |
system = require('system'), | |
loc, address; | |
if (system.args.length < 3) { | |
console.log('Usage: screenshot.js <some URL> <some LOCATION>'); | |
phantom.exit(); | |
} | |
//viewportSize being the actual size of the headless browser |
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\Jobs\Domains; | |
use App\Events\Domains\ScreenshotUpdated; | |
use App\Jobs\Job; | |
use App\Models\Domain; | |
use Carbon\Carbon; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Queue\InteractsWithQueue; |
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\Http\Controllers\Api\V1; | |
use App\Http\Controllers\Controller; | |
use App\Jobs\Domains\Screenshot; | |
use App\Models\Domain; | |
use Illuminate\Http\Request; | |
class DomainsController extends Controller |
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; | |
use Illuminate\Database\Eloquent\Model; | |
class Domain extends Model | |
{ | |
/** | |
* The attributes that are mass assignable. |
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
var Mapper = require('./Mapper'), | |
Model = require('./Model'); | |
var User = Model.extend({ | |
attributes: { | |
name: String, | |
email: String | |
} | |
}); |
NewerOlder