Skip to content

Instantly share code, notes, and snippets.

View MatthieuScarset's full-sized avatar
🤷‍♂️
Probably me

MattGyver MatthieuScarset

🤷‍♂️
Probably me
View GitHub Profile
@StevenGFX
StevenGFX / twig-tweak.md
Last active March 11, 2025 13:31
Twig Tweak Cheat Sheet
@patitonar
patitonar / DepositsV1.sol
Created September 12, 2019 15:10
Deposit example in solidity. Get contract balance, anyone can deposit, anyone can withdraw all the balance
pragma solidity 0.5.11;
contract Deposits {
event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount);
function deposit() public payable {
emit Deposited(msg.sender, msg.value);
}
/*
This exercise has been updated to use Solidity version 0.5
Breaking changes from 0.4 to 0.5 can be found here:
https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html
*/
pragma solidity ^0.5.0;
contract SimpleBank {
@MatthieuScarset
MatthieuScarset / fixpermissions
Created July 19, 2018 02:36
Fix permissions on Docker-based env with Drupal
//Files should be `644` I think
find . -type f -exec chmod u=rw,g=r,o=r {} \;
// Folders should be `executable
find . -type d -exec chmod u=rwx,g=rx,o=rx {} \;
@abarriosr
abarriosr / ach-bulk-import.php
Last active April 4, 2022 14:30
Bulk Import Script with pagination support. Allows massive import of entities from Content Hub.
<?php
/**
* @file
* Add entities from Content Hub to the Import Queue.
*
* Please locate this field in the 'scripts' directory as a sibling of docroot:
* <DOCROOT>/../scripts/ach-bulk-import.php
*
* To run the script, execute the drush command:
* $drush scr ../scripts/ach-bulk-import.php
@MatthieuScarset
MatthieuScarset / .lando.yml
Last active August 15, 2024 14:31
Correct settings for XDebug + VSCode + Lando (+3.0)
# Lando version is at least +3.0
name: drupal-nine
recipe: drupal9
services:
appserver:
webroot: web
xdebug: debug
config:
php: .vscode/php.ini
Solidity lets you program on Ethereum, a blockchain-based virtual machine that allows the creation and execution of smart contracts, without needing centralized or trusted parties.
Solidity is a statically typed, contract programming language that has similarities to Javascript and C. Like objects in OOP, each contract contains state variables, functions, and common data types. Contract-specific features include modifier (guard) clauses, event notifiers for listeners, and custom global variables.
Some Ethereum contract examples include crowdfunding, voting, and blind auctions.
As Solidity and Ethereum are under active development, experimental or beta features are explicitly marked, and subject to change. Pull requests welcome.
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
@gabesullice
gabesullice / ResponseSubscriber.php
Last active March 28, 2025 10:32
Dynamically Redirecting Drupal 8 Node Pages
<?php
/**
* This file should live at my_module/src/EventSubscriber/ResponseSubscriber.php
*/
namespace Drupal\my_module\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\Event;
@skwashd
skwashd / README.md
Last active May 27, 2020 07:24
Drupal git pre-commit hook

This pre-commit hook is designed to be used for Drupal 7 and 8 sites.

Download the pre-commit file. Save it as .git/hook/pre-commit in your git repo. You need to ensure that the file is executable.

If you want this to be added to all new projects automatically, add it to your git init templates.

To install and PHP CodeSniffer for Drupal, please read the official documentation.

To see this working checking out this short YouTube video.

// Get element offset from top of page
function getOffset(el) {
el = el.getBoundingClientRect();
return {
left: el.left + window.scrollX,
top: el.top + window.scrollY
};
};