Skip to content

Instantly share code, notes, and snippets.

View musikele's full-sized avatar

Michele Nasti musikele

View GitHub Profile
@musikele
musikele / machine.js
Last active August 13, 2020 15:45
Generated by XState Viz: https://xstate.js.org/viz
const unloaded = {
on: {
LOAD: {
target: 'stopped'
}
}
}
const stopped = {
entry: ['stopAction'],
@musikele
musikele / machine.js
Created July 17, 2020 08:33
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions

Creazione di un form and aggancio a MagNews

  • Per ogni campo del form, assicurarsi che sia settato anche il nome per il campo (Avanzate -> Opzioni per lo Script)
  • il nome deve essere minuscolo
  • il form deve avere anche un bottone submit che deve avere anch'esso un "name"

Per inviare dati a magnews:

//Groovy version
ratpack {
handlers {
get {
//if you do a GET on http://localhost:5050/ this handler will answer
response.send("Hello World!");
}
path('create') {
byMethod {
post {
$productDetail = array();
$productDetail[0] = array(
'ProductCode' => '1',
'SKU' => 'AK-7',
'Name' => 'Elicottero a induzione’,
'Description' => 'per stare senza pensieri',
'Quantity' => 1,
'Price' => 0.03,
'UnitPrice' => 0.03,
@musikele
musikele / php_to_xml_nusoap.php
Created September 13, 2016 13:42
an example of php that becomes a xml request
$param = array(
'shopLogin' => $shopLogin
,'uicCode' => $currency
,'amount' => $amount
,'shopTransactionId' => $shopTransactionID
);
$objectresult = $client->call('Encrypt', $param);
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//here is the remote call...
$objectresult = $client->call('Encrypt', $param);
//after the call, this code will print the request and the response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
div .my-first-flexbox {
display: flex; // this will activate flexbox; other properties are optional
justify-content: ... ;
align-items: ... ;
flex-direction: ... ;
}
div.my-first-flexbox .item {
@musikele
musikele / wrong_example.js
Last active February 23, 2016 10:36
mixing es5 and es6 will kill you
var UserService = function() {
this.num = 0;
this.users = [];
}
/*
correct way:
var UserService = () => {
this.num = 0;
this.users = [];
}