Skip to content

Instantly share code, notes, and snippets.

View danieldevine's full-sized avatar
💭
I may be slow to respond.

Dan Devine danieldevine

💭
I may be slow to respond.
View GitHub Profile
@pzygier
pzygier / MoodleValetDriver.php
Last active June 13, 2024 02:27 — forked from sandeepgill/MoodleValetDriver.php
Laravel Valet Moodle driver
<?php
namespace Valet\Drivers\Custom;
use Valet\Drivers\LaravelValetDriver;
class MoodleValetDriver extends LaravelValetDriver
{
protected $isStyleUri = false;
protected $baseUri = '';
protected $moodleStaticScripts = [
@chrispymm
chrispymm / twill-settings-media-upload.md
Created June 10, 2020 06:51
[Enable media upload on settings pages] #twill

In order to upload the image in the crops for the image need to be added to the settings array in the twill config file.

'settings' => [
        'crops' => [
            '[NAME]' => [
                '[CROP]' => [
                    [
                        'name' => 'foobar',
 'ratio' =&gt; 1,
@kshitiz621
kshitiz621 / whois.php
Created March 19, 2019 07:44
PHP code to get WHOIS information of a domain
<?php
/*************************************************************************
php easy :: whois lookup script
==========================================================================
Author: php easy code, www.phpeasycode.com
Web Site: http://www.phpeasycode.com
Contact: webmaster@phpeasycode.com
*************************************************************************/
$domain = $_GET['domain'];
@brendansparrow
brendansparrow / vertical-rhythm-mixin.scss
Last active January 30, 2023 11:26
A Sass mixin for maintaining vertical rhythm
$font-size: 16px;
$line-height-ratio: 1.5;
$line-height-base: 1rem * $line-height-ratio;
// base line-height = 16px * 1.5 = 24px
html {
font-size: $font-size;
line-height: $line-height-ratio;
background: url(http://basehold.it/i/24);
}
@poul-kg
poul-kg / valet.conf
Last active July 2, 2025 19:35
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
@clemlatz
clemlatz / smooth-scroll.js
Created September 6, 2017 08:56
Simple smooth-scroll animation in pure/vanilla javascript
/**
* Smooth scroll animation
* @param {int} endX: destination x coordinate
* @param {int) endY: destination y coordinate
* @param {int} duration: animation duration in ms
*/
window.smoothScrollTo = function(endX, endY, duration) {
var startX = window.scrollX || window.pageXOffset,
startY = window.scrollY || window.pageYOffset,
distanceX = endX - startX,
Sometimes there's a terrible penalty for telling the truth.
—The Great Lie (1941)
Sometimes even Cupid needs a little help!
—The Model and the Marriage Broker (1951)
Sometimes any man can be a giant . . .
—Giant (1956)
Sometimes murder is just a way to pass the time.
@febridev
febridev / controller.php
Created April 3, 2017 16:18
eloquent laravel group by year
// Carbon
use Carbon\Carbon;
$visitorTraffic = PageView::select('id', 'title', 'created_at')
->get()
->groupBy(function($date) {
return Carbon::parse($date->created_at)->format('Y'); // grouping by years
//return Carbon::parse($date->created_at)->format('m'); // grouping by months
});
@einkoro
einkoro / CustomWordPressValetDriver.php
Last active November 11, 2022 11:01
Custom WordPress Valet driver for installs that aren't in the root project directory
<?php
class CustomWordPressValetDriver extends WordPressValetDriver
{
/**
* Custom suffix for site path.
*
* @var string
*/
const sitePathSuffix = '/www';