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");
@walkerjeffd
walkerjeffd / Synology-Diskstation-Git.md
Last active April 27, 2024 15:39
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@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
@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'];
@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@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.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@davebarnwell
davebarnwell / brew-dnsmasq.md
Last active May 3, 2024 10:13
install dnsmasq with brew

Install dnsmasq and configure for *.dev.local domains

$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf

Reload configuration and clear cache

# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/

$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

@mikob
mikob / AWS, ELB, CF and Let's Encrypt
Last active February 15, 2024 13:47
AWS, ELB, Let's Encrypt
Elastic Load Balancer, CloudFront and Let's Encrypt