Skip to content

Instantly share code, notes, and snippets.

View arabcoders's full-sized avatar

Abdulmohsen arabcoders

View GitHub Profile

Microframework

This is a PHP microframework based on anonymous functions.

Features

  • requested URLs matched using regular expressions
  • request methods (matches using regular expressions too)
  • differenced FIFO queues for each $priority
  • command line usage
  • backward compatibility
  • integrated Dependency Injection system
  • settings system
@arabcoders
arabcoders / instaTweet.js
Last active December 16, 2015 20:59
Slightly modified version of Twitter Instagram Cards by ChrisBradBury, i fixed few bugs with the @grant option, and i've added open/close button for images & its now works when you load older tweets or new tweets comes in. original script URL : https://userscripts.org/scripts/show/153881
// ==UserScript==
// @name Twitter Instagram Cards - Photo Viewer
// @namespace http://chrisbradbury.net
// @author Chris Bradbuyr
// @author AbdulMohsen B. A. A.
// @version 1.2
// @description Now that Instagram have pulled their twitter support, this script adds back inline instagram photos.
// @include https://twitter.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.js
// @grant setTimeout
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
reboot
<?php
require 'json.php';
$json = new JSON;
$json->foo->bar->baz = "foo";
$json->foo->biz = "test";
$json->baz = array();
$json->baz[1] = "testing";
#!/usr/bin/php
<?php
// copied from http://phpadvent.org/2008/dont-commit-that-error-by-travis-swicegood
// authored by Travis Swicegood
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
<?php
use PhpParser\Node;
use PhpParser\Node\Expr;
error_reporting(E_ALL);
ini_set('memory_limit', -1);
//$dir = __DIR__ . '/../../Symfony_2.3';
@arabcoders
arabcoders / Twitter Instagram Cards
Last active August 29, 2015 14:13
This script is orginally written by Chris Bradbury and i took it and fixed some bugs such as CSP protection in chome since instagram still serve images over HTTP while the CSP in twitter disallow embeding any HTTP content., there is few things i want to do at long term such as using MutationObserver instead of looping and using twitter internal …
// ==UserScript==
// @name Twitter Instagram Cards
// @namespace http://arabcoders.co
// @author ArabCoders, Orginally Written By: Chris Bradbury
// @version 2.0.1
// @description Now that Instagram have pulled their twitter support, this script adds back inline instagram photos, fixed CSP in Chrome 29+
// @include https://twitter.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.js
// @grant setTimeout
// @grant GM_xmlhttpRequest
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;