Skip to content

Instantly share code, notes, and snippets.

@stefan-jonker
stefan-jonker / wrap-paragraphs.js
Created July 27, 2017 17:36 — forked from kavanagh/wrap-paragraphs.js
Wrap an array of strings with p tags
var paragraphs = ['paragraph 1', 'paragraph 1'];
var html = '<p>' + paragraphs.join('</p><p>') + '</p>';
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
border: 1px solid #ddd;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
@stefan-jonker
stefan-jonker / filters.php
Created October 26, 2015 17:56 — forked from zmsaunders/filters.php
HTML Output Minification in laravel 4
<?php
### --- Snip --- ###
App::after(function($request, $response)
{
// HTML Minification
if(App::Environment() != 'local')
{
if($response instanceof Illuminate\Http\Response)
@stefan-jonker
stefan-jonker / VirtualHost-script
Last active August 29, 2015 14:10
Attempt to automate the creation of VirtualHost for Apache
require 'fileutils'
require 'etc'
if ENV['USER'] != 'root'
raise "Script needs root-access to write in some folders."
else
print "Name of the website: "
siteName = gets.chomp()
print "Owner of the site in the Apache-folder (Default: \"#{Etc.getlogin})\": "
@stefan-jonker
stefan-jonker / svg2png.js
Created August 21, 2014 20:45 — forked from gustavohenke/svg2png.js
Converting SVG to PNG.
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@stefan-jonker
stefan-jonker / Add custom styling to Polymer
Created August 13, 2014 22:58
Add custom styling to Polymer
var element = document.querySelector('custom-element');
element.innerHTML = '<style> :host(.class) { ... } </style>';
[].forEach.call(
document.querySelectorAll(''),
function (el) {
console.log(el);
}
);
<head>
<link rel="import" href="path/to/x-foo.html">
</head>
<body>
<x-foo></x-foo>
<script>
// http://www.polymer-project.org/docs/polymer/polymer.html#polymer-ready
window.addEventListener('polymer-ready', function(e) {
var xFoo = document.querySelector('x-foo');
@stefan-jonker
stefan-jonker / jQuery introductie
Created August 15, 2012 23:03
jQuery introductie
<!doctype html>
<html>
<head>
<metacharset="utf-8">
<title>Demo</title>
<style>
th.headerSortUp {
background-color: #3399FF;
}
@stefan-jonker
stefan-jonker / jQuery introductie
Created August 15, 2012 23:02
jQuery introductie
$(document).ready(function() {
$("a[name]").css("background", "#eee" );
$("a[href*='stefanjonker']").css("color", "#FF0000");
$('#faq').find('dd').hide().end().find('dt').click(function() {
$(this).next().slideToggle();
});
});
$(document).ready(function() {