Skip to content

Instantly share code, notes, and snippets.

View Fedik's full-sized avatar
🐢

Fedir Zinchuk Fedik

🐢
  • Ukraine
View GitHub Profile
@bohwaz
bohwaz / php-8.1-strftime.php
Last active May 14, 2024 13:55
strftime() replacement function for PHP 8.1
<?php
namespace PHP81_BC;
/**
* Locale-formatted strftime using \IntlDateFormatter (PHP 8.1 compatible)
* This provides a cross-platform alternative to strftime() for when it will be removed from PHP.
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
*
* Usage:
* use function \PHP81_BC\strftime;
@anakadote
anakadote / plugin.min.js
Last active September 7, 2017 08:35
A TinyMCE 4.* plugin to add support for Typekit fonts - place in a new folder at tinymce/plugins/typekit/ and replace kitId value. Don't forget to add "typekit" to your TinyMCE "plugins" config array.
tinymce.PluginManager.add('typekit', function(editor) {
editor.on('init', function() {
// Get the DOM document object for the IFRAME
var doc = this.getDoc();
// Create the script we will add to the header asynchronously
var jscript = "(function(d) {\n\
var config = {\n\
kitId: 'xxxxxxx',\n\
<?php
use Doctrine\DBAL\Driver\PDOSqlite\Driver;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\ORM\Proxy\ProxyFactory;
use Ramsey\Uuid\Doctrine\UuidType;
@CptFoobar
CptFoobar / lsgpu.c
Last active June 11, 2018 18:37
Quick command line utility to list OpenCL compatible devices, along with their important attributes. (OpenCL must be previously installed)
/*
* Program to list all attached devices that support OpenCL, along with their key
* attributes.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
@Ocramius
Ocramius / html-form-validator-factory.php
Created December 26, 2015 18:26
Form validation from HTML form
<?php
$formHtml = <<<'HTML'
<form action="%s" method="post">
<label for="email">Email:</label>
<input
type="email"
id="email"
name="email"
value=""
@fevangelou
fevangelou / default.vcl_PREFACE.md
Last active April 9, 2024 04:30
The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

Updated on December 15th, 2021

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites. It obviously depends on your use case.

@mcaskill
mcaskill / Function.Date-Format-Conversion.php
Last active February 6, 2024 11:22
PHP : Translate date/time format between `date()` and `strftime()`
<?php
/**
* Convert date/time format between `date()` and `strftime()`
*
* Timezone conversion is done for Unix. Windows users must exchange %z and %Z.
*
* Unsupported date formats : S, n, t, L, B, G, u, e, I, P, Z, c, r
* Unsupported strftime formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x
*
anonymous
anonymous / CSS-Animated-Beer-Pour-(Forked-from-CSS-Beaker-Pen).markdown
Created December 11, 2014 13:05
CSS Animated Beer Pour (Forked from CSS Beaker Pen)
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@mccabe615
mccabe615 / gist:8411428
Created January 14, 2014 01:25
GenyMotion ARM Fix
Genymotion is a Virtual Android Environment built on x86 and Virtualbox. It's not an ARM emulator so it's performance is way better than the Android SDK Emulator. However in their latest update they've removed both ARM Translation and Google Play Apps. (This is what causes the "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE" errors) Many Devs and Users still find these features very useful for various reasons and their removal has forced people to look for alternatives to Genymotion.
This guide is for getting back both ARM Translation and Google Play apps in your Genymotion VM.
UPDATE-v1.1: I've gotten more up-to-date builds of libhoudini and have updated the ZIP. This fixes a lot of app crashes and hangs. Just flash the new one and it should work.
Download the following ZIPs:
ARM Translation Installer v1.1 - http://goo.gl/JBQmPa(Mirrors) ON DROPBOX
Download the correct GApps for your Android version:
Google Apps for Android 4.3 - http://goo.im/gapps/gapps-jb-20130813-signed.zip ON DROPBOX
Google Apps for Android 4.2