Skip to content

Instantly share code, notes, and snippets.

@marcus-at-localhost
marcus-at-localhost / dropbox-php-auth.md
Created June 28, 2021 08:07 — forked from phuze/dropbox-php-auth.md
Dropbox API V2: PHP Authentication Process

Effective September 2021, Dropbox will be deprecating long-lived access tokens.

This GIST generally describes how to authenticate requests to Dropbox API v2, for anyone working on a server-side PHP Dropbox implementation.

It's important to understand three types of codes you'll encounter:

  1. Access Code - this is a one-time code that represents user-granted app access.
  2. Access Token - this is short-lived token that provides access to Dropbox API endpoints.
  3. Refresh Token - this is a long-lived token that allows you to fetch a fresh Access Token.
@ademers
ademers / craft-cms-postmark-mailer-component.php
Last active March 29, 2023 10:51
Craft CMS Postmark Mailer Component
<?php
return [
'components' => [
'mailer' => function() {
// Get the stored email settings
$settings = craft\helpers\App::mailSettings();
// Override the transport adapter class
$settings->transportType = craft\postmark\Adapter::class;
@Chapoton
Chapoton / gulpfile.js
Created May 29, 2019 14:31
Updated gulpfile for Smashing Magazine article
// Updated gulpfile for the following article: https://www.smashingmagazine.com/2018/07/pattern-library-first-css/
'use strict';
const gulp = require('gulp');
const fractal = require('./fractal.js');
const logger = fractal.cli.console;
const sass = require('gulp-sass');
const sassGlob = require('gulp-sass-glob');
const plumber = require('gulp-plumber');
@Log1x
Log1x / countdown.js
Created January 22, 2019 01:27
Vanilla JS Countdown Timer
/**
* Countdown
*/
function init() {
const second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
const date = document.querySelector('[data-date]').dataset.date;
@danielstgt
danielstgt / imagick3.4.3-PHP7.3-forge.sh
Last active May 30, 2023 22:43 — forked from rostockahoi/imagick3.4.3-PHP7.2-forge.sh
Install Imagick 3.4.3 on PHP 7.3 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar xvzf imagick-3.4.3.tgz
@samhernandez
samhernandez / haxor.twig
Last active December 2, 2022 21:40
Craft 3 gain access to admin account for support cases or when owner loses access
{#
Resets the username, password, and email address
of the first found Admin account in case of
lost admin access or for support cases.
#}
{% set values = {
username: 'me',
password: craft.app.security.hashPassword('mypassword'),
email: 'me@site.com',
passwordResetRequired: 0
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@khalwat
khalwat / load-balancer-app.php
Created February 26, 2018 17:25
Keep hashed directories consistent in a load balanced server environment with Craft CMS 3
<?php
/**
* Yii Application Config
*
* Edit this file at your own risk!
*
* The array returned by this file will get merged with
* vendor/craftcms/cms/src/config/app/main.php and [web|console].php, when
* Craft's bootstrap script is defining the configuration for the entire
* application.
@rtripault
rtripault / plugin.php
Created June 23, 2017 08:58
Sample plugin to display the welcome screen to any new member login for the first time in MODX Revolution manager
<?php
/**
* A sample plugin to display the "welcome message" to all users, login for the first time in Revo manager
*
* @var modX $modx
* @var array $scriptProperties
* @var modPlugin $this
*
* @see modPlugin::process()
*
@sergomet
sergomet / GoogleDriveServiceProvider.php
Created April 1, 2017 07:01 — forked from ivanvermeyen/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.