Skip to content

Instantly share code, notes, and snippets.

View WietseWind's full-sized avatar
⌨️
Focusing

Wietse Wind WietseWind

⌨️
Focusing
View GitHub Profile
@WietseWind
WietseWind / json.twig
Last active June 15, 2016 07:10
nodum.io - Cart (JSON) + Cart Modify (Winkelwagentje in nodum)
{% 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 / my-demo-project.twig
Created June 24, 2016 08:10
Posting data from Ruby to nodum, saving in a static txt file
{% do api.IO_staticFile("ruby/post.txt").set(param.post|print_r) %}
@WietseWind
WietseWind / datatables-sort.js
Created June 24, 2016 11:41
Nummeriek NL sorteren in DataTables
aTableExt.oSort["string-nbr-asc"] = function(x,y) {return ((parseFloat(x.replace('.',"").replace(',','.')) < parseFloat(y.replace('.',"").replace(',','.'))) ? -1 : ((parseFloat(x.replace('.',"").replace(',','.')) > parseFloat(y.replace('.',"").replace(',','.'))) ? 1 : 0));};
jQuery.fn.dataTableExt.oSort["string-nbr-desc"] = function(x,y) {return ((parseFloat(x.replace('.',"").replace(',','.')) < parseFloat(y.replace('.',"").replace(',','.'))) ? 1 : ((parseFloat(x.replace('.',"").replace(',','.')) > parseFloat(y.replace('.',"").replace(',','.'))) ? -1 : 0));};
var $dataTableOptions = {
'iDisplayLength' : 1000,
'lengthMenu' : [ 500,1000,2000 ],
'aoColumns' : [
null,
null,
null,
@WietseWind
WietseWind / formulier.twig
Last active June 24, 2016 12:45
PDF maken en opslaan o.b.v. variabelen
<h1>Formulier</h1>
<p>Hele mooie resultaten</p>
<b>Naam:</b> {{ naam }} <br />
<b>Adres:</b> {{ adres }} <br />
<b>Plaats:</b> {{ plaats }} <br />
<b>Telefoon:</b> {{ telefoon }} <br />
@WietseWind
WietseWind / config.ini
Last active June 25, 2016 13:14
Simplicate CRM koppeling (contactformulier) met nodum
[simplicate]
; De API Key en Secret kun je verkrijgen binnen Simplicate, bij Instellingen - Algemeen - API
key = "xxxxxxxxxxxxx1w7KSMtzwp06PjLG"
secret = "xxxxxxxxxxL2l80V89r9wG0sl93SY"
env = "nodum.simplicate.nl"
[notification]
; De Slack URL is er een van het type Webhook, maak deze op:
; https://www.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks
slackurl = "https://hooks.slack.com/services/T03trRCBD6GND/MT5ZWGAJLMW/a9pGlguwNB037T5GlU"
@WietseWind
WietseWind / notification.twig
Created July 10, 2016 09:16
Slack notificatie met sabre.post i.p.v. api.Notification_Slack (voor als je naar een ander team wilt sturen dan in de configuratie aanwezig)
{% do sabre.post('https://hooks.slack.com/services/xx/yy/zz', {
text: "Nieuwe lead :tada: Bezoek het lead-panel voor meer informatie of om de lead toe te kennen.\n*Details:*\n",
username: "nodum",
icon_url: "https://nodumapp.io/static/apple-touch-icon-180x180.png",
channel: "@ipub_wietse",
attachments : [
{
color : "#4C6ADF",
fallback: "Lead: " ~ param.post.company,
text: param.post.desc.short,
@WietseWind
WietseWind / demo.twig
Created July 20, 2016 16:46
Time-validator voor Boilerplate
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<script>
$.validate({
modules : 'date'
});
</script>
@WietseWind
WietseWind / webservice.twig
Created July 27, 2016 19:38
Calling webservices with nodum
<h1>Websrvices</h1>
{% set ws =
api
.WebService_Connect('http://www.swanandmokashi.com/Homepage/Webservices/QuoteOfTheDay.asmx?WSDL')
.addHeader('http://swanandmokashi.com/GetQuote', 'QuoteofTheDayHttpPost', ''|date('YmdHis') )
%}
{{ ws.getFunctions | pre }}
{{ ws.getQuote | pre }}
@WietseWind
WietseWind / sms.twig
Created July 27, 2016 19:39
Sending SMS with Clockwork using nodum
<h1>SMS versturen</h1>
<p>Vul het onderstaande formulier in om een SMS te verzenden</p>
{% if param.postAll() %}
{% set sms = api.Clockwork_sms(param.postRaw('from'),param.postRaw('to'),param.postRaw('message')) %}
{% if sms.sent %}
<p class="alert alert-groen">
Verzonden!
@WietseWind
WietseWind / image.twig
Created July 27, 2016 19:39
Getting (from media, static) an image, resizing, serving
{% trim %}
{% do twig.noTemplate().addHeader('Content-type: image/png') %}
{% set image = api.IO_staticFile('1.png').get() %}
{#{{ api.Image_Resize(image, 100, 'center').data|raw }}#}
{#{{ api.Image_Resize(image, 100).data|raw }}#}
{#{{ api.Image_Resize(image, 100,125).data|raw }}#}
{{ api.Image_Resize(image, rest.get.size|default(100),'center').data|raw }}
{% endtrim %}