Skip to content

Instantly share code, notes, and snippets.

View KaiserWerk's full-sized avatar

Robin K. KaiserWerk

  • Germany
  • 09:30 (UTC +02:00)
View GitHub Profile
@im4aLL
im4aLL / php-event-listener-example.php
Last active August 18, 2024 18:18
PHP event listener simple example
<?php
// Used in https://github.com/im4aLL/roolith-event
class Event {
private static $events = [];
public static function listen($name, $callback) {
self::$events[$name][] = $callback;
}
@mattes
mattes / check.go
Last active February 19, 2025 20:32
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@thejeffreystone
thejeffreystone / PHP LDAP Function to verify user credentials
Last active February 10, 2021 14:39
PHP LDAP Function to verify user credentials
public function verifyLdapUser($username,$password)
{
$DomainName=LDAPDOMAIN; // name = domain
$ldap_server=LDAP; // server = ldap://doman.co
// returns true when user/pass binds to LDAP/AD.
$auth_user=$username."@".$DomainName;
//Check to see if LDAP module is loaded.
if (extension_loaded('ldap')) {