Skip to content

Instantly share code, notes, and snippets.

View pvanliefland's full-sized avatar

Pierre Vanliefland pvanliefland

View GitHub Profile
@pvanliefland
pvanliefland / README.md
Last active July 16, 2024 11:25
Django embed template tag

embed template tag

Rationale

The issue

When working on a web application, you may have, on different screens, a variable number of similar components with minor differences. A "card" component is a good example: every card has a wrapper section element, a title, and an arbitrary content wrapped inside a div element.

Consider the following simplified HTML example of an application :

string content = story.Continue().Trim();
List<string> tags = story.currentTags;
if (tags.Count > 0) {
string lastTag = tags.Last().ToString();
if (lastTag == "positiveChoice") {
Debug.Log("Last Tag" + lastTag);
}
}
@pvanliefland
pvanliefland / coucou.py
Last active April 25, 2018 20:11
My Ludus Gist
def yell(name):
print ("HEY %s" % name.upper())
@pvanliefland
pvanliefland / Camera.js
Created June 7, 2017 14:33
react-native-camera (workarounds)
import React from 'react';
import {Platform, PermissionsAndroid, View} from 'react-native';
import RNCamera from 'react-native-camera';
/**
* Overridden Camera module
*
* 3 goals:
* - handle Android permissions (https://github.com/lwansbrough/react-native-camera/issues/224 as well as
* https://github.com/lwansbrough/react-native-camera/issues/671)
@pvanliefland
pvanliefland / ImagePicker.js
Last active December 28, 2020 06:23
react-native-image-picker (workarounds)
import {Platform, PermissionsAndroid} from 'react-native';
import RNImagePicker from 'react-native-image-picker';
/**
* Overrides react-native-image-picker
*
* Attempts to fix:
*
* - https://github.com/react-community/react-native-image-picker/issues/385
* - https://github.com/react-community/react-native-image-picker/issues/581
<?xml version="1.0"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT22.35S" minBufferTime="PT11.22S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
<Period>
<AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
<Representation bandwidth="90885" codecs="mp4a.40.2" id="audio-und">
<BaseURL>https://staging-black.youhaveajack.com/3b606a62-b6a1-450b-a124-baf1007a3765_2df04d9df096f7acdae4cf6ca38a89a0/3b606a62-b6a1-450b-a124-baf1007a3765_2df04d9df096f7acdae4cf6ca38a89a0-audio-und.mp4?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9zdGFnaW5nLWJsYWNrLnlvdWhhdmVhamFjay5jb20vM2I2MDZhNjItYjZhMS00NTBiLWExMjQtYmFmMTAwN2EzNzY1XzJkZjA0ZDlkZjA5NmY3YWNkYWU0Y2Y2Y2EzOGE4OWEwLzNiNjA2YTYyLWI2YTEtNDUwYi1hMTI0LWJhZjEwMDdhMzc2NV8yZGYwNGQ5ZGYwOTZmN2FjZGFlNGNmNmNhMzhhODlhMC1hdWRpby11bmQubXA0KiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTQ2NjMyMjYwOX19fV19&amp;Signature=VmdxSpwv441ROfG-pgr8ScDIFnRzc48JkxohUF8LK~YoI-q-r3IS
<?xml version="1.0"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT2M0.80S" minBufferTime="PT6.03S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
<Period>
<AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
<Representation bandwidth="200002" codecs="mp4a.40.2" id="audio-und">
<BaseURL>https://staging-black.youhaveajack.com/d4234479-0cee-4100-aa25-8e2497b9745a_61bfe38a1540573d83c605d9f7f76efb/d4234479-0cee-4100-aa25-8e2497b9745a_61bfe38a1540573d83c605d9f7f76efb-audio-und.mp4?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9zdGFnaW5nLWJsYWNrLnlvdWhhdmVhamFjay5jb20vZDQyMzQ0NzktMGNlZS00MTAwLWFhMjUtOGUyNDk3Yjk3NDVhXzYxYmZlMzhhMTU0MDU3M2Q4M2M2MDVkOWY3Zjc2ZWZiL2Q0MjM0NDc5LTBjZWUtNDEwMC1hYTI1LThlMjQ5N2I5NzQ1YV82MWJmZTM4YTE1NDA1NzNkODNjNjA1ZDlmN2Y3NmVmYi1hdWRpby11bmQubXA0KiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTQ2NjI2NTQ1MX19fV19&amp;Signature=rjVwWVVCkhyJNhmhx6EU-qYEb9yCiGSK3cjOVgXbq4X9Pt7Da~2
{
"port": 3333,
"cookieParser" : "hsjknvnvmdgfsgj5678@#$%^&dfsfd",
"broker": "tcp://127.0.0.1:10001"
}
print "complex facets"
query = {
"query": {
"match_all": {}
},
"facets": {
"facet1": {
"terms" : {"field" : "formations.group.name"},
"nested": "formations.group"
}
@pvanliefland
pvanliefland / config_prod.yml
Created August 24, 2013 08:58
Raven config
monolog:
handlers:
main:
type: fingers_crossed
action_level: critical
handler: grouped
grouped:
type: group
members: [nested, buffered]
buffered: