Skip to content

Instantly share code, notes, and snippets.

View lesaff's full-sized avatar
🎯
Focusing

Rudy Affandi lesaff

🎯
Focusing
View GitHub Profile
@jasonvarga
jasonvarga / hooks.rename_date_fields.php
Last active August 29, 2015 13:59
Small add-on to rename Statamic's date/time fields.
<?php
class Hooks_rename_date_fields extends Hooks
{
public function control_panel__add_to_foot()
{
if (URL::getCurrent() == '/publish') {
return $this->js->inline('
var form = $(".primary-form");
form.find("label:contains(\'Publish Date\')").text("New date field name");
@jasonvarga
jasonvarga / _readme.md
Last active August 29, 2015 14:23
Restricting an account to specific sections in the CP

Simple Statamic CP edit restrictions

  • Add the hooks file to _add-ons/restrict_to/hooks.restrict_to.php.
  • Add the restrict_to tags field to your _config/bundles/member/fields.yaml.
  • To restrict pages, add them to the restrict_to field. eg. /blog, /calendar. They will only be allowed to edit pages that begin with this url.

Warning

If your member listing is visible, (it is by default), they can edit their own restricted pages.

@ruckuus
ruckuus / LoginControllerProvider.php
Last active July 9, 2017 20:46
Silex User Authentication and PHP ActiveRecord
<?php
/*
* Put it in App/Provider
*/
namespace App\Provider;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@maietta
maietta / command.txt
Last active April 22, 2019 14:49
PowerDNS on Ubuntu 18.04+
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo ls -lh /etc/resolv.conf
sudo rm /etc/resolv.conf
sudo echo "nameserver 1.1.1.1" > /etc/resolv.conf
sudo apt-get update
sudo apt-get install pdns-server pdns-backend-mysql
@msurguy
msurguy / Ajax-Instructions.md
Created April 4, 2014 22:52
Morris bar charts with AJAX (Laravel)

Did I hear you wanted AJAX charts instead of hard coded? You got it.

Follow this guide to integrate bar chart reports into your Laravel application with AJAX. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

@Wysie
Wysie / gist:03934b6a79a715772abd
Last active December 10, 2019 20:01
Upload to Amazon S3 Instead of Server for Sendy Email Image Uploads
//Using S3.php from https://github.com/tpyo/amazon-s3-php-class. Place it in includes/helpers
//Replaces Sendy's includes/create/upload.php
<?php
include('../functions.php');
include('../login/auth.php');
require_once('../helpers/S3.php');
//Init
$file = $_FILES['file']['tmp_name'];
@clsource
clsource / 401-response.php
Created July 30, 2014 19:55
Helper for Creating REST Web Services with ProcessWire
<?php
/*
* 401 Response
*
* Sends a 401 Response Unauthorized
*
* @author Camilo Castro
*
* @date 29/07/2014
@atouchard
atouchard / varnish-install.sh
Last active September 29, 2021 16:16
Install Varnish on MacOSX via Homebrew
#!/bin/sh
#
# Install Varnish via Homebrew
#
# You need to add /usr/local/sbin in your PATH
# vcl files are in /usr/local/etc/varnish
#
# Usage :
@trdarr
trdarr / hubot-digitalocean.md
Last active March 28, 2022 20:34
Deploying Hubot on DigitalOcean (with Slack integration)
@senko
senko / onchange.sh
Last active July 14, 2023 07:54
OnChange - Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of