Skip to content

Instantly share code, notes, and snippets.

@cereal-s
cereal-s / 00. tutorial.md
Created October 2, 2017 17:02 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
@cereal-s
cereal-s / pre-commit
Created May 1, 2018 15:31 — forked from hraban/pre-commit.md
Git pre-commit hook (.git/hooks/pre-commit) to prevent accidentally committing debug code (add NOCOMMIT in source comment)
#!/bin/sh
# This pre-commit hook will prevent you from committing any line (or filename) containing
# the string NOCOMMIT. Use that tag in comments around source code you want to avoid
# accidentally committing, like temporary IP addresses or debug printfs.
#
# To add it to an existing repository, save it to .git/hooks/pre-commit (or append, if
# that file already exists). Remember to make executable (chmod +x ...)
#
# To automatically add this pre-commit hook to every repository you create or clone:
@cereal-s
cereal-s / mb_str_pad.php
Created May 17, 2018 21:53 — forked from nebiros/mb_str_pad.php
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string
@cereal-s
cereal-s / VideoStream.php
Last active February 5, 2020 14:39 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@cereal-s
cereal-s / _description.md
Created June 26, 2018 17:14 — forked from andytlr/_description.md
Convert SVG <polyline> to <path> so they can be animated with D3 etc.

Convert SVG polyline to path

Replace all instances of <polyline with <path and points=" with d="M.

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1000px" height="1000px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
-<polyline fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" points="100.712,141.534 582.904,227.835 425.37,478.521
+
@cereal-s
cereal-s / get_combinations.php
Last active August 26, 2019 08:47 — forked from cecilemuller/get_combinations.php
PHP: Get all combinations of multiple arrays (preserves keys)
<?php
function get_combinations($arrays) {
$result = [[]];
foreach ($arrays as $property => $property_values) {
$tmp = [];
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
@cereal-s
cereal-s / combos.php
Last active August 26, 2019 09:26 — forked from farinspace/combos.php
Recursive functions, I can never find exactly what I need in a pinch
<?php
/**
* Generate combinations from multidimensional array
*/
function combos($data, $count, &$all = [], $group = [], $val = null, $i = 0) {
if (null !== $val) {
$group[] = $val;
<?php
/**
* Plugin Name: Custom Fields for WooCommerce
* Description: Add custom fields to WooCommerce products
* Version: 1.0.0
* Author: Gareth Harris
* Author URI: https://pluginrepublic.com/
* Text Domain: cfwc
* WC requires at least: 3.4.0
* WC tested up to: 3.4.2
@cereal-s
cereal-s / net start & stop commands
Created March 25, 2021 09:47 — forked from jamiejohnsonkc/net start & stop commands
net start / net stop #win, #cmd
net start [serviceName]
and
net stop [serviceName]
tell you whether they have succeeded or failed pretty clearly. For example
U:\>net stop alerter
The Alerter service is not started.
@cereal-s
cereal-s / pandoc_filter_procedures.md
Created April 24, 2021 15:14 — forked from dixonsiu/pandoc_filter_procedures.md
How to convert markdown link to html using Pandoc

How to convert markdown link to html using Pandoc

Issue

Pandoc cannot convert a link's URL as expected.
Markdown:

[Document](./document.md)

HTML:

Document