Skip to content

Instantly share code, notes, and snippets.

View alxy's full-sized avatar

Alexander Guth alxy

  • PwC Germany
  • Germany
View GitHub Profile
@LukeTowers
LukeTowers / backend.list.injectRowClass.php
Last active January 12, 2017 21:59
OctoberCMS Event Examples
<?php namespace Vendor\Plugin
use Event;
use Vendor\Plugin\Models\MyModel;
use Vendor\Plugin\Controllers\MyController;
class Plugin
{
public function boot()
{
import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
# Define custom py_func which takes also a grad op as argument:
def py_func(func, inp, Tout, stateful=True, name=None, grad=None):
# Need to generate a unique name to avoid duplicates:
rnd_name = 'PyFuncGrad' + str(np.random.randint(0, 1E+8))
@seriousManual
seriousManual / packstations.php
Last active February 1, 2021 15:14
Minimal code example for a SOAP call to the DHL API (Packstations search)
<?php
$userName = 'fooUser';
$password = 'fooPassword';
$endpoint = 'https://cig.dhl.de/services/sandbox/soap';
$client = new SoapClient("https://cig.dhl.de/cig-wsdls/com/dpdhl/wsdl/standortsuche-api/1.0/standortsuche-api-1.0.wsdl", [
'login' => $userName,
'password' => $password,
'location' => $endpoint,
@juriansluiman
juriansluiman / comments.tag
Created January 28, 2015 10:49
The react tutorial for riot
<comment-box>
<h1>{ opts.title }</h1>
<comment-list url={ opts.url } comments={ comments } />
<comment-form url={ opts.url } />
this.comments = []
add(comment) {
this.comments.push(comment)
@kohnmd
kohnmd / flatten.php
Last active September 20, 2021 12:48
Function to recursively flatten multidimensional PHP array.
<?php
// Requires PHP 5.3+
// Found here: http://stackoverflow.com/a/1320156
function flatten_array(array $array) {
$flattened_array = array();
array_walk_recursive($array, function($a) use (&$flattened_array) { $flattened_array[] = $a; });
return $flattened_array;
}
@daftspunk
daftspunk / example-plugin.js
Last active March 20, 2016 21:23
JS Plugin Boilerplate
/*
* Example plugin
*
* Data attributes:
* - data-control="example" - enables the plugin on an element
* - data-option="value" - an option with a value
*
* JavaScript API:
* $('a#someElement').myPlugin({ option: 'value' })
*