Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cereal-s on github.
  • I am cereal_ (https://keybase.io/cereal_) on keybase.
  • I have a public key whose fingerprint is FD33 B0C7 6279 29DD C23F 8180 374E DDFF 4BE9 C8D4

To claim this, I am signing this object:

@cereal-s
cereal-s / index.html
Created September 7, 2017 09:32 — forked from karbassi/index.html
How to handle single and double click events separately in javascript.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Single and Double Click</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="the_div"></div>
<span>Double click the block</span>
@cereal-s
cereal-s / ping.gs.php
Created September 8, 2017 13:44
Get number of pages from a PDF, using GhostScript.
<?php
/**
* Return the number of pages of a PDF.
*
* Imagick::pingImage() takes too much when dealing with big files.
*
* Command to execute:
*
* gs -q -dNODISPLAY -c "(%s) (r) file runpdfbegin pdfpagecount = quit"
<?php
/**
* Trait helps to allow for some limited overloading of
* methods in the class this is attached to.
*/
trait Overloader {
/**
* Where the magic happens
@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 / shell
Created January 6, 2018 17:09
Ubuntu 17.10 prevents Gparted and other applications that require root access to run in GUI, run the following before executing the program.
xhost +si:localuser:root
@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 / split.php
Created June 9, 2018 20:15
Split CSV columns
<?php
// Usage:
// php split.php < input.csv > output.csv
// CSV format example:
// street,"city, state",zip
// "3526 HIGH ST","SACRAMENTO, CA",95838
// "51 OMAHA CT","SACRAMENTO, CA",95823
// "2796 BRANCH ST","SACRAMENTO, CA",95815
@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 = "";