Skip to content

Instantly share code, notes, and snippets.

View andiwand's full-sized avatar

Andreas Stefl andiwand

  • CERN
  • Geneva
View GitHub Profile
@dominicglenn
dominicglenn / shared-state-behavior.html
Last active December 8, 2016 22:19
A way of having global state that can be read and written to separately per component
<script>
StateReceiverBehavior = {
attached: function() {
var component = this;
Object.keys(component.properties).forEach(function(propertyName){
var property = component.properties[propertyName];
if(property.linkState){
component.set(propertyName, window.AppStateComponent.get(property.linkState));
@gchudnov
gchudnov / cpp_utf8_utf16.cpp
Created November 6, 2014 19:33
C++ string conversion UTF8 <-> UTF16
#include <string>
#include <locale>
#include <codecvt>
//UTF-8 to UTF-16
std::string source;
//...
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
std::u16string dest = convert.from_bytes(source);
@dermesser
dermesser / libfcgi-example.c
Created July 3, 2014 11:14
In case anyone wants to see a multi-threaded FastCGI application written with the fcgiapp library.
# include <stdlib.h>
# include <stdio.h>
# include <sys/stat.h>
# include <pthread.h>
# include <fcgiapp.h>
const char* const sockpath = "/tmp/fcgicpp.sock";