Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
Focusing

Wietse Wind WietseWind

⌨️
Focusing
View GitHub Profile
@WietseWind
WietseWind / sample.twig
Created May 19, 2016 10:33
Mollie iDeal betaling test + sample met nodum.io
View sample.twig
{% if param.post.id %}
{# Callback from Mollie? #}
{% do api.IO_staticFile('mollie.txt').set(api.Payment_Mollie.getPayment(param.post.id)|print_r) %}
{% endif %}
<h4>Betalen via Mollie</h4>
{% set payAmount = 1.50 %}
{% if rest.get.pay and api.Payment_Mollie.getMethods[rest.get.pay] %}
@WietseWind
WietseWind / select2required.js
Created May 27, 2016 11:56
Select2 "required"
View select2required.js
$(".searchselect").each(function(){
if($(this).attr('required')){
$(this).before(
'<input required="required" class="'+$(this).attr('class')+' fake-field" tabindex="-1" type="text" name="'+$(this).attr('name')+'" id="'+$(this).attr('id')+'" />'
);
$(this).attr('d-name', $(this).attr('name'));
$(this).removeAttr('name');
}
$(this).select2().on('change', function(){
if($(this).attr('d-name')){
@WietseWind
WietseWind / qr-from-upload.twig
Created May 27, 2016 13:07
QR code uit een file upload
View qr-from-upload.twig
<h1>QR Reader</h1>
{% if param.files(true).foto.data %}
{#{% set data = api.IO_staticFile('qr/test.png').get() %}#}
{{ api.Barcode_QR(param.files(true).foto.data)|pre }}
{% else %}
@WietseWind
WietseWind / json.twig
Last active June 15, 2016 07:10
nodum.io - Cart (JSON) + Cart Modify (Winkelwagentje in nodum)
View json.twig
{% if param.postAllRaw() %}
{% set cart = session.get.cart|default({}) %}
{% set postdata = {
code : param.postAllRaw().code|s,
title : param.postAllRaw().title,
count : param.postAllRaw().count|default(1)|i
} %}
{% if cart[param.postAllRaw().code] %}
{% set postdata = postdata|merge({ count : ( postdata.count + cart[param.postAllRaw().code].count|i ) }) %}
@WietseWind
WietseWind / indexing-job.twig
Last active June 15, 2016 07:10
nodum.io - Zoeken + Wildcard zoeken in nodum (Search)
View indexing-job.twig
Nodum CLI, version: {{ config.getVersion() }}
Ophalen uit Profit:
{% set raw_data = profit.get('I4U_Producten') %}
{{ raw_data|length }} resultaten.
{% set data = [] %}
{% for d in raw_data %}
{% set zoekinfo = (d.artcode ~ ' ' ~ d.artikel ~ ' ' ~ d.pdoms)|lower|preg_replace("@[^a-z0-9]@", " ")|preg_replace("@[ ]+@", " ")|trim %}
@WietseWind
WietseWind / merge.twig
Last active June 15, 2016 07:11
nodum.io - Waarde aan array mergen
View merge.twig
{% set data = [
{ naam : "Wietse", leeftijd: 12 },
{ naam : "Tosca", leeftijd: 23 },
{ naam : "Trinko", leeftijd: 28 },
{ naam : "Wietse", leeftijd: 5 }
] %}
{% set newdata = [] %}
@WietseWind
WietseWind / upload.twig
Last active June 15, 2016 07:11
nodum.io - File upload met nodum
View upload.twig
<h1>Lekker uploaden</h1>
{{ param.files(true)|pre }}
<form method="post" enctype="multipart/form-data" action="{{ index }}">
<input type="file" name="file[]" />
<button type="submit">Verstuur</button>
</form>
@WietseWind
WietseWind / ftp.twig
Last active June 15, 2016 07:11
nodum.io - FTP in nodum
View ftp.twig
<h1>FTP</h1>
{% set ftp = api.IO_ftpClient('10.20.213.20', 'ipub', 'yYBg') %}
{{ ftp.ls('Scanner/')|pre }}
{{ ftp.mkdir('Scanner/bla/')|pre }}
{{ ftp.set('Scanner/test.txt', 'Hallo :D Groeten van Wietse')|pre }}
@WietseWind
WietseWind / json.twig
Last active June 15, 2016 07:11
nodum.io - Social Profiles with nodum
View json.twig
{% do twig.noTemplate().addHeader('Content-type: application/json;') %}
{% trim %}
{% if socialprofile.getConnectedProviders %}
{% set profiles = [] %}
{% for p in socialprofile.getConnectedProviders %}
{% set profiles = profiles|merge({ (p) : socialprofile.getProfile(p) }) %}
{% endfor %}
{{ {
msg : 'hasProviders',
@WietseWind
WietseWind / NL.ini
Last active June 15, 2016 07:12
nodum.io - Nodum Auth Vertalingen
View NL.ini
auth = "Autorisatie"
login = "Inloggen"
pwchange = "Wachtwoord wijzigen"
logout = "Uitloggen"
noaccess = "Geen toegang"
loggedinwelcome = "Je bent ingelogd!"
noaccessdesc = "Je bent niet ingelogd. Om toegang te krijgen tot deze pagina dien je eerst in te loggen."
relogin = "Je bent reeds ingelogd. Om opnieuw in te loggen dien je eerst uit te loggen."
pwchangelogin = "Om je wachtwoord te wijzigen dien je eerst in te loggen."
logoutok = "Je bent met succes uitgelogd."