Skip to content

Instantly share code, notes, and snippets.

@danharper
danharper / a-FormatController.php
Last active August 1, 2017 12:06
A Laravel Controller which allows you to display API/report data in multiple formats. For example, you may display a preview as HTML, and offer buttons to download as CSV and JSON.
<?php
// this is the base controller which parses output to HTML/CSV/JSON depending on the format in the URL
use Illuminate\Support\Collection;
class FormatController extends Controller {
protected $fileName = 'export';
protected $view = 'reports.output';
@dglazkov
dglazkov / gist:efd2deec54f65aa86f2e
Last active April 29, 2023 14:54
The Shadow DOM Diaries

#The Shadow DOM Diaries

Feature design is hard, and takes time. With time, it doesn't matter how public and consistent you are with communication during design process. In the end, it all will look like a jumbled mess of emails and bug comments. That seems bad. To make things less bad, I decided to start writing these little docs. Here they are. I may add more. Or not. Whatevs.

Sometimes You Need to Build a Larger Thing First looks back at the road we've traveled.

Shadow DOM Evolution outlines the path forward.

Why Do We Only Allow Children in Insertion Points provides a glimpse into the reasoning behind current insertion point design.

@stefanzweifel
stefanzweifel / slack.php
Created May 8, 2014 13:26
Slack.com Webhook Integration (PHP) - Simple snippet which tells you, how to build your payload array.
<?php
//Options
$token = 'YOUR_TOKEN_HERE';
$domain = 'YOUR_SLACK_DOMAIN_GOES_HERE';
$channel = '#general';
$bot_name = 'Webhook';
$icon = ':alien:';
$message = 'Your message';
@markknol
markknol / ExternalUtil.hx
Created September 17, 2014 12:59
Native alert/prompt/confirm message for Flambe
package temple.utils;
import flambe.System;
/**
* @author Mark Knol [http://blog.stroep.nl]
*/
class ExternalUtil
{
#if air
public static var airBrowser:AirBrowser = new AirBrowser();
<?php sensei_simple_course_price( $course->ID ); ?>
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@davidalbers
davidalbers / TextOverAVRCP.java
Created September 4, 2015 18:39
Example for sending text over AVRCP from an Android application.
/**
* Generalized code from botifier, source code at https://github.com/grimpy/Botifier
* Provides example methods for sending text over AVRCP from an Android application.
* AVRCP is the Bluetooth protocol your phone uses to send song information to your car stereo/smartwatch.
* Only for Android 5.0+
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
//in activity or service
@gamemachine
gamemachine / ItemCatalog.cs
Created September 12, 2015 23:43
Scriptablable object as protobuf message container
using UnityEngine;
using io.gamemachine.messages;
namespace GameMachine {
namespace ItemManagement {
[CreateAssetMenu(menuName =@"ItemCatalog")]
public class ItemCatalog : ScriptableProtobuf<PlayerItems> {
}
}
@resmall
resmall / gist:51b328aa303b15979e77
Last active December 18, 2024 03:38
Imports an sql file and execute the script in Laravel Seeder
public function run() {
DB::unprepared(File::get('path/to/SQL/file'));
}
@ivanvermeyen
ivanvermeyen / EnsureQueueListenerIsRunning.php
Last active February 13, 2024 12:40
Ensure that the Laravel queue listener is running with "php artisan queue:checkup" and restart it if necessary. You can run this automatically with a cron job: http://laravel.com/docs/scheduling
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class EnsureQueueListenerIsRunning extends Command
{
/**
* The name and signature of the console command.