Skip to content

Instantly share code, notes, and snippets.

View ihortymoshenko's full-sized avatar

Ihor Tymoshenko ihortymoshenko

View GitHub Profile
@andrieslouw
andrieslouw / cfban.php
Created October 11, 2016 15:21
Cloudflare V4 PHP API - block / unblock IP in firewall
<?php
/**
* @author https://github.com/andrieslouw
* @copyright 2016
**/
function cfban($ipaddr){
$cfheaders = array(
'Content-Type: application/json',
'X-Auth-Email: your@email.com',
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@JeOam
JeOam / Structure.md
Last active April 18, 2023 06:52
Project Structure for Python (Tornado) Application

Project:

  • project/: A directory named with the project's name which stores the actual Python package
    • __init__py
    • app.py
    • settings.py
    • urls.py
    • models/
      • __init__.py
      • baes.py
  • handlers/
@Golpha
Golpha / IP-Guide.md
Created August 23, 2014 02:25
The PHP IP Guide

The PHP IP Guide

This guide shows you common practices to convert IPv4- and IPv6-Addresses into their binary representation.

Who is responsible for this ?

This guide has been written by Matthias Kaschubowski, a autodidactical software developer from germany with about 14 years of practice converting coffee to code. He works in his free time as a php evangelist on a lot of platforms ( last shown as tr0y on php.de, a german PHP related forum and as himself as an adminstrator at the largest PHP-related facebook group ).

Basics

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 30, 2024 08:12
A badass list of frontend development resources I collected over time.
@menacestudio
menacestudio / backbone_ajax1.js
Created March 12, 2013 22:30
Backbone: Override AJAX methods
/** Global override to make all AJAX calls as POST type */
Backbone.ajax = function() {
var args = Array.prototype.slice.call(arguments, 0);
return Backbone.$.ajax.apply(Backbone.$, _.extend(args, {type: 'POST'}));
};
/** Manual override per call */
Collection.fetch({data: {id: 34}, type: 'POST'});
@mywaiting
mywaiting / graceful_shutdown_tornado_web_server.py
Last active May 7, 2022 08:30
The example to how to shutdown tornado web server gracefully...
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7
"""
@krymen
krymen / phing
Created November 21, 2012 11:16
Phing bash completion
# /etc/bash_completion.d/phing
_phing () {
local cur prev
COMPREPLY=()
buildfile=build.xml
_get_comp_words_by_ref cur prev
[ ! -f $buildfile ] && return 0
@havvg
havvg / JasmineHandler.php
Created October 31, 2012 16:57
Symfony2 + Jasmine = JasmineHandler
<?php
namespace Ormigo\Tests;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
class JasmineHandler
{
protected $templating;