Skip to content

Instantly share code, notes, and snippets.

View storkontheroof's full-sized avatar
💭
typing

Richard van den Winkel storkontheroof

💭
typing
View GitHub Profile
@storkontheroof
storkontheroof / toCSV.php
Created March 20, 2019 07:42
Function to export an array to CSV
<?php
function toCSV(array $data, array $colHeaders = array(), $asString = false) {
$stream = ($asString)
? fopen("php://temp/maxmemory", "w+")
: fopen("php://output", "w");
if (!empty($colHeaders)) {
fputcsv($stream, $colHeaders);
}
@storkontheroof
storkontheroof / twitter-parser.js
Last active July 29, 2016 05:12
A simple javascript parser for properly displaying a Tweet (e.g. with links) from a Twitter feed
// The parser expects a single node from a twitter feed and returns HTML
// Usage:
// var tweets = <some array with tweets from an API call>;
// Parse first tweet:
// var tweetHTML = TwitterParser.parseText(tweets[0]);
// console.log(tweetHTML);
(function (window, undefined) {
function escapeHTML(html) {
var text = document.createTextNode(html);
@storkontheroof
storkontheroof / Alternate use of a mixin in Sass
Last active July 21, 2016 07:43
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
body {
font-size: 1.2em;
}
@mixin not-really-a-mixin-but-damn-handy {
@storkontheroof
storkontheroof / Sass media query mixin
Last active July 21, 2016 07:45
Generated by SassMeister.com.
@mixin mq($point, $query1: min, $query2: width, $IE9: false) {
@if $IE9 == true{
.lt-ie9 & {
@content;
}
}
@if $query1 == "min" {
$point: $point + 1;
}