Skip to content

Instantly share code, notes, and snippets.

View LouWii's full-sized avatar

Louis D. LouWii

View GitHub Profile
@LouWii
LouWii / verify-hard-links
Last active August 29, 2015 14:08
Verify links to files, to know if accessible or not
@LouWii
LouWii / regex-url-parts.php
Created October 1, 2015 23:20
regex to handle different parts of a URL (host, path, query, anchor...)
<?php
$re = "/^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/";
$str = "http://www.ics.uci.edu/pub/ietf/uri/?page=3&color=red#Related\n";
preg_match($re, $str, $matches);
/* matches will be
1. [0-5] `http:`
2. [0-4] `http`
@LouWii
LouWii / robot.js
Created December 7, 2012 10:25 — forked from jaskolek/robot.js
ForkedBot
var robots = new Array();
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.start = function( ev ){
@LouWii
LouWii / robot.js
Created December 7, 2012 12:32
YouCannotLoose
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@LouWii
LouWii / nginx.conf
Last active December 22, 2015 11:19 — forked from leon/nginx.conf
NGinx Server block configuration for Symfony 2 app.
# Things needed to be adapted :
# server_name my-domain.com
#
# root /home/www
# The root of the Symfony "web" folder (with app.php and app_dev.php in it).
#
# fastcgi_pass unix:/var/run/php5-fpm.sock
# This sock can be elsewhere (/var/run/php5-fpm/php5-fpm.sock for example...)
#
# There are other things needed to be changed/fixed.
@LouWii
LouWii / enable_telnet.md
Last active December 7, 2016 03:55
Scan environment and set the best channel possible on your DJI Phantom 3 Standard controller and drone (requires telnet enabled)

Keybase proof

I hereby claim:

  • I am louwii on github.
  • I am louwii (https://keybase.io/louwii) on keybase.
  • I have a public key whose fingerprint is ECB5 44C1 9BE3 DA64 96A9 324C D904 BB01 4F59 5F3B

To claim this, I am signing this object:

@LouWii
LouWii / functions.php
Last active December 15, 2016 04:09
Force wordpress embedded content to be https
//Add this code to the end of the functions.php file of your wordpress theme
// This forces images urls and links of your website to be displayed with https
function force_https_the_content($content) {
if ( is_ssl() )
{
$content = str_replace( 'src="http://my-domain.tld', 'src="https://my-domain.tld', $content );
$content = str_replace( 'href="http://my-domain.tld', 'href="https://my-domain.tld', $content );
}
return $content;
}
@LouWii
LouWii / AcmePathRoles.php
Last active August 31, 2018 15:56 — forked from leotiger/allowed_roles_for_route.md
Symfony3: Check if a route is accessible for a ROLE or a list of ROLES
<?php
namespace Acme\Security\Roles;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Bridge\Monolog\Logger;