Skip to content

Instantly share code, notes, and snippets.

View Geolim4's full-sized avatar
🇺🇦
💕🇫🇷

Georges.L Geolim4

🇺🇦
💕🇫🇷
View GitHub Profile
@Geolim4
Geolim4 / config.json
Last active August 29, 2015 14:18 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@Geolim4
Geolim4 / config.json
Last active August 29, 2015 14:18 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@Geolim4
Geolim4 / patmatch.php
Created April 11, 2015 23:44
Simple wildcard pattern matching function, using built-in preg_match
function match_wildcard( $wildcard_pattern, $haystack ) {
$regex = str_replace(
array("\*", "\?"), // wildcard chars
array('.*','.'), // regexp chars
preg_quote($wildcard_pattern)
);
return preg_match('/^'.$regex.'$/is', $haystack);
}
@Geolim4
Geolim4 / index.html
Last active August 29, 2015 14:23 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link href="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
</head>
<body>
<select style="width: 300px;" multiple="multiple">
<!-- <optgroup label="Swedish Cars">-->

PhpFastCache has some options that you may want to know before using them, here's the list:

File-based drivers options *

  • default_chmod | int>octal (default: 0777) [>=V4] This option will define the chmod used to write driver cache files.
  • securityKey | string (default: 'auto') [>=V4] A security key that define the subdirectory name.
  • htaccess | bool (default: true) [>=V4] Option designed to (dis)allow the auto-generation of .htaccess.

* Drivers like Files, Sqlite, Leveldb, etc.

Global options

use phpFastCache\CacheManager;

// Setup File Path on your config files
CacheManager::setup(array(
    "path" => '/var/www/phpfastcache.com/dev/tmp', // or in windows "C:/tmp/"
));

// In your class, function, you can call the Cache
$InstanceCache = CacheManager::getInstance('files');
    use phpFastCache\CacheManager;

    $cache = CacheManager::Memcached();

    // try to get from Cache first.
    $resultsItem = $cache->getItem("identity_keyword")

    if(!$resultsItem->isHit()) {
 $resultsItem-&gt;set($cURL-&gt;get("http://www.youtube.com/api/json/url/keyword/page"))-&gt;expireAfter(3600*24);
    use phpFastCache\CacheManager;

    $cache = CacheManager::Memcached();

    $keyword_webpage = md5($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING']);
    // try to get from Cache first.
    $resultsItem = $cache->getItem($keyword_webpage)

 if(!$resultsItem-&gt;isHit()) {
use phpFastCache\CacheManager;

$memCache = CacheManager::getInstance("memcached");
$redisCache = CacheManager::getInstance("redis");
$filesCache = CacheManager::getInstance("Files");

/**
* Get Items
*/
// ==UserScript==
// @name Doctrine Time Threshold Filter
// @namespace Doctrine
// @version 1
// @grant none
// ==/UserScript==
(function () {
function loadScript(url, callback) {
var script = document.createElement("script")