Skip to content

Instantly share code, notes, and snippets.

View coderua's full-sized avatar
🇺🇦
Stand with Ukraine

Volodymyr Chumak coderua

🇺🇦
Stand with Ukraine
View GitHub Profile
@shiawuen
shiawuen / index.html
Created December 29, 2011 15:05
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>
@anatooly
anatooly / gist:3364496
Created August 15, 2012 23:04
Git pre-commit hook
#!/bin/bash
# Author: Anatooly <anatooly.com>
# Based on code by Nikolaos Dimopoulos
# Based on code by Remigijus Jarmalavicius
# Checks the files to be committed for the presence of print_r(), var_dump(), die()
# The array below can be extended for further checks
php_checks[1]="var_dump("
php_checks[2]="print_r("
@qmmr
qmmr / learnThemByHeart.js
Last active February 6, 2018 09:59
Tips & Tricks of JavaScript
/* Collection by Marcin Kumorek © 2013 */
/* falsy values */
/*
null
undefined
''
0
NaN
false
@Mins
Mins / mysql_secure.sh
Last active May 31, 2024 14:19
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@stuartcarnie
stuartcarnie / clear-apc.php
Last active February 25, 2024 11:07
Self-contained php script to clear shared-memory cache in php5-fpm via command-line. In this instance it is clearing APC, but can be easily changed to clear other shared-memory caches.
#!/usr/bin/env php
<?php
/*
Copyright 2013 Stuart Carnie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@juneym
juneym / php-gearman-worker-nonblocking
Created September 14, 2013 04:07
PHP Gearman Worker (non-blocking) -- based on the PHP doc.
<?php
declare(ticks = 1);
$terminate = false;
pcntl_signal(SIGTERM, function() use (&$terminate) {
$terminate = true;
echo "Terminating = true \n";
});
@jeremeamia
jeremeamia / Twilio_Client.php
Last active May 15, 2018 21:45
The beginnings of a Guzzle-based, PHP Twilio client.
<?php
namespace Twilio;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Collection;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Model;
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;
@aFarkas
aFarkas / focus-within.js
Last active August 20, 2020 10:49
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;