Skip to content

Instantly share code, notes, and snippets.

View jamesmills's full-sized avatar

James Mills jamesmills

View GitHub Profile
<script>
AnyTrack(function() {
// generates the user client id
var at_click_id = AnyTrack('atclid');
var campaign = new Retreaver.Campaign({
campaign_key: '{{ $campaign['retreaverCampaignKey'] }}'
});
var tags = {
@jamesmills
jamesmills / anytrack_leadbyte_example.html
Last active October 13, 2023 06:32
Extracting the AnyTrack Click ID to append to the LeadByte Custom Form integration.
<script>
AnyTrack(function() {
// Extract atclid once AnyTrack script is loaded
var atclid = AnyTrack('atclid');
var c1 = "7 Facebook Ad Tips";
// Append AnyTrack Click ID to LeadByte form url
var url = new URL(window.location.href);
var search_params = url.searchParams;
search_params.set('atclid', atclid);
@jamesmills
jamesmills / mysql.php
Created July 7, 2023 12:11
Fill Gaps in Statistical Time Series - Date by the hour
$requests = DB::table('advert_requests as ar')
->select(DB::raw("date_format(ar.created_at, '%Y-%m-%d %H' ) AS grouped_hour, count(*) AS requests"))
->join('placements as p', 'p.id', '=', 'ar.placement_id')
->where('ar.created_at', '>=', $from)
->where('p.site_id', $site_id)
->groupBy('grouped_hour')
->get();
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class GenerateDropForeignKeyMigration extends Command
{
// Let's say you have a local package which you want to do some develoment on by including it in another project
/Users/jamesmills/Projects/Packages/larapex-charts
// You can use this one-liner to have composer install it from you local file system
composer config repositories.local '{"type": "path", "url": "/Users/jamesmills/Projects/Packages/larapex-charts"}' --file composer.json
// Which will add this to your composer.json file
"repositories": {
"local": {
"type": "path",
@jamesmills
jamesmills / TreewareCombined.md
Last active April 7, 2020 09:34
Treeware Combined

Treeware Treeware Treeware (Trees)

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

January 2020

Anupdated version of this can be found on our Treeware About Us Page.

Treeware Launch

We are proud to announce the launch of Treeware.

We have partnered up with Offset Earth, to plant trees & fund the world’s best climate crisis solutions. We chose Offset Earth because they operate transparently with a minimal service fee, which they use to spread the message through social marketing.

Treeware Option One

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Treeware Option Two

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

$response = (new Client())->post('https://api.datadoghq.com/api/v1/series?api_key=' . config('core.datadog.api_key'),
[
RequestOptions::JSON => [
'series' => [[
'metric' => 'test.metric',
'points' => [
array(365),
array(13456789, 123)
],
// 'type' => 'rate',