Skip to content

Instantly share code, notes, and snippets.

View flydev-fr's full-sized avatar
🐛
Working from home

j. eizmendi flydev-fr

🐛
Working from home
View GitHub Profile
@flydev-fr
flydev-fr / raw.pas
Created September 22, 2022 07:26 — forked from synopse/raw.pas
latest raw for TechEmpower framework benchmarks
program raw;
{
TechEmpower framework benchmarks implementation
See https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview
}
{$I mormot.defines.inc}
{.$define USE_SQLITE3}
@flydev-fr
flydev-fr / simple.pulseway.pas
Created July 10, 2019 06:46
Send Pulseway Notification in Delphi with Indy TIdHTTP.
{ procedure PULSEWAY }
procedure TForm1.Button1Click(Sender: TObject);
var
Json: string;
LResponse: string;
JsonToSend: TStringStream;
begin
Json := '{"instance_id": "' + 'rest-v2' +
'","title": "' + 'MyTitle' +
@flydev-fr
flydev-fr / .bash_profile
Last active February 4, 2019 12:39
Wireshell - grab and install the latest ProcessWire development version from the last commit.
# ProcessWire Wireshell bash alias
# grab and install the latest ProcessWire development version from the latest commit
alias pwnew='wireshell new --sha=`git ls-remote https://github.com/processwire/processwire refs/heads/dev | cut -f1`'
# upgrade to the latest ProcessWire development version from the latest commit
alias pwup='wireshell upgrade --sha=`git ls-remote https://github.com/processwire/processwire refs/heads/dev | cut -f1`'
@flydev-fr
flydev-fr / FieldtypeFloat.hook.php
Last active December 18, 2018 10:11
↪️ Hook to add FieldtypeDecimal to compatible fieldtypes of a FieldtypeFloat when a superuser need to change the type of an existing float field - ProcessWire
/**
* Hook : place this hook in admin.php
*
* Add FieldtypeDecimal to compatible fieldtypes of
* a FieldtypeFloat when a superuser need to change the type
* of a float field.
*
* https://modules.processwire.com/modules/fieldtype-decimal/
* https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/
*
@flydev-fr
flydev-fr / FacebookLike.module
Last active December 18, 2018 09:44 — forked from almonk/FacebookLike.module
Facebook Like module for ProcessWire
<?php
class FacebookLike extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Facebook Like Button',
'version' => 101,
'summary' => 'Display Facebook like buttons on your Processwire site.',
@flydev-fr
flydev-fr / LikeSystem.module.php
Last active December 18, 2018 10:13
Module / POC - Like system for ProcessWire Pages - ProcessWire
<?php namespace ProcessWire;
class LikeSystem extends WireData implements Module {
const minVersion = '3.0.0';
protected $tableName = 'likes_system';
public static function getModuleInfo()
{
@flydev-fr
flydev-fr / debug.php
Last active September 1, 2016 22:05
debug function, outptut in console dev. browser
<?php
// debug function
function debug ($data) {
echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}";
$output = explode("\n", print_r($data, true));
foreach ($output as $line) {
if (trim($line)) {
$line = addslashes($line);
echo "console.log(\"{$line}\");";
}
<?php namespace ProcessWire;
/*
* https://processwire.com/talk/topic/14133-displaying-code-snippets-on-the-front-end-with-ckeditor/
*
* exemple working with highlightJS (https://highlightjs.org/)
* Howto:
* - include highlightjs css: <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
* - javascript: <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
* - write the following code in your main js script file eg: main.js
@flydev-fr
flydev-fr / check_mime_type_content.php
Created July 9, 2016 21:00
Check mime type with finfo.
// [...]
$field = $this->modules->get("InputfieldFile"); // dummy field
$field->attr("name+id", 'photo');
$form->add($field);
// DO NOT TRUST $_FILES['photo']['mime'] VALUE !!
// Check MIME Type by yourself.
$finfo = new \finfo(FILEINFO_MIME_TYPE);