Skip to content

Instantly share code, notes, and snippets.

@alphp
alphp / NativeMethods.psm1
Created August 27, 2018 04:08
PowerShell module for send WM_SETTINGCHANGE after change Environment variables in Windows
Add-Type -Namespace Win32 -Name NativeMethods -MemberDefinition @"
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, uint fuFlags, uint uTimeout, out UIntPtr lpdwResult);
"@
function Send-SettingChange {
$HWND_BROADCAST = [IntPtr] 0xffff;
$WM_SETTINGCHANGE = 0x1a;
$result = [UIntPtr]::Zero
##
## How to install mcrypt in php7.2 / php7.3
## Linux / MacOS / OSX
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
#
@migmolrod
migmolrod / config.yml
Created September 1, 2015 02:23
Adding a translatable language switcher to JMSI18nRoutingBundle
parameters:
locale: 'es_ES'
locales: [ 'de', 'en_GB', 'es_ES', 'fr' ]
jms_i18n_routing:
default_locale: %locale%
locales: %locales%
twig:
globals:
@ajaxray
ajaxray / symfony2-bundle-config.md
Last active February 7, 2019 12:02
Symfony2 - Getting Bundle configuration from app/config/config.yml as a separated config block

APPROACH 1: Getting it as a parameter

With an extension (more on extensions here) you can keep this easily "separated" into different blocks in the config.yml and then inject that as a parameter gettable from the controller.

Inside your Extension class inside the DependencyInjection directory write this:

class MyNiceProjectExtension extends Extension
{
 public function load( array $configs, ContainerBuilder $container )
@anorth
anorth / ZoomLayout.java
Created March 29, 2014 00:06
Pinch-zoomable Android frame layout
package au.id.alexn;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.FrameLayout;
@gggeek
gggeek / ProcessManager.php
Created July 9, 2013 09:59
A simple process-manager in php, which uses forking to run tasks - putting a limit on the number of concurrent processes (aka a queue)
<?php
/**
* A simple process manager, forking jobs to run in parallel. Works on linux and windows.
*
* @copyright G. Giunta
* @license GPL v2
*
* @todo add more methods? f.e. one to kill any the executing processes
*/