Skip to content

Instantly share code, notes, and snippets.

@ChristofKaufmann
ChristofKaufmann / FastLED_RGBW.h
Created May 26, 2021 11:17
This is a workaround for FastLED library to make SK6812 RGBW led strips work.
/* FastLED_RGBW
*
* Hack to enable SK6812 RGBW strips to work with FastLED.
*
* Original code by Jim Bumgardner (http://krazydad.com).
* Modified by David Madison (http://partsnotincluded.com).
* Modified by Christof Kaufmann.
*
*/
@vijayrana99
vijayrana99 / google-reviews.php
Created March 3, 2021 13:58
Retrieve google reviews on website using Curl Request in PHP
<?php
$cid = 1417698146920752799; //CID of a place can be genrated from https://pleper.com/index.php?do=tools&sdo=cid_converter
//execute curl
$url = 'https://maps.googleapis.com/maps/api/place/details/json?cid='.$cid.'&key=<API-KEY>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$data = curl_exec($ch);
@maitrungduc1410
maitrungduc1410 / create-vod-hls.sh
Last active June 28, 2024 04:26
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@atuline
atuline / circring.ino
Last active February 16, 2022 14:12
Circular loader ring
/* Circular loader ring (a real basic one)
*
* By: Andrew Tuline
*
* Date: May, 2019
*
* One version uses a loop and fixed colours, while the other uses a fader.
*
*/
@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
@ilkermutlu
ilkermutlu / convert.md
Last active April 9, 2024 11:23
Convert PDF file to v1.4
// Not much of PHP magic
// This just takes a PDF file from a path
// and executes Ghostscript to convert your
// PDF to version 1.4

// You need to have Ghostscript installed
// See https://www.ghostscript.com/Documentation.html

$PDFFile = '/path/to/your/pdf.pdf';
@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@ardyantohermawan
ardyantohermawan / ngrok-install.sh
Created November 7, 2017 06:30
Ngrok Service Ubuntu 16.04
#!/bin/bash
# download
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
# unzip
unzip ngrok-stable-linux-amd64.zip
# move to /usr/local/bin
sudo mv ngrok /usr/local/bin
@ohthehugemanatee
ohthehugemanatee / RestaurantEntity.php.diff
Created September 18, 2017 11:10
Add revisions to an existing entity. In a project for RAS I had to add revisions to an existing entity. There are some small modifications necessary to the entity class itself, and two update hooks to apply the schema changes (core's normal process won't allow you to modify the schema of an entity type with existing data). Note that entity_ui=TR…
use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\RevisionableContentEntityBase;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
@@ -19,6 +20,7 @@
* @ContentEntityType(
* id = "restaurant",
* label = @Translation("Restaurant"),
+ * show_revision_ui = TRUE,
@yavuztas
yavuztas / index.html
Last active February 7, 2023 17:25
remove-rubber-band-web-apps-ios
<!DOCTYPE html>
<html>
<head>
<title>Remove rubberband scrolling from web apps on mobile safari and standalone (iOS)</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<style>
html, body {margin: 0; padding: 0; width:100%; height:100%; overflow: hidden; background: #333}
p.center {