Skip to content

Instantly share code, notes, and snippets.

View JPKCom's full-sized avatar
🏠
Working from home

Jean Pierre Kolb JPKCom

🏠
Working from home
View GitHub Profile
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
$(document).ready(function(){
// queryStrip
function queryStrip(string) {
string = string.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + string + '=([^&#]*)'),
results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ''));
}
@JPKCom
JPKCom / .htaccess
Last active August 29, 2015 14:19 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
var image = new Image();
image.src = "sample.jpg";
$(image).load(function() {
ctx.drawImage(image, 0, 0);
});
$(canvas).click(function(e) {
var canvasOffset = $(canvas).offset();
var canvasX = Math.floor(e.pageX-canvasOffset.left);
var canvasY = Math.floor(e.pageY-canvasOffset.top);
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<h2>Original CSS</h2>
<style style="display: block; white-space: pre; font-family: monospace">
h2 { margin:0; }
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
/**
* jQuery BASE64 functions
*
* <code>
* Encodes the given data with base64.
* String $.base64Encode ( String str )
* <br />
* Decodes a base64 encoded data.
* String $.base64Decode ( String str )
@JPKCom
JPKCom / letsencrypt_ubuntu_nginx.md
Created January 7, 2016 09:15 — forked from leommoore/letsencrypt_ubuntu_nginx.md
Letsencrypt Ubuntu 14.04 Nginx

#Letsencrypt Ubuntu 14.04 Nginx Letsencrypt (https://letsencrypt.org) is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain.

Note: As of 7th Dec 2015 letsencrypt is still in public beta.

##Installation To install the client, clone the repostiory from github.

git clone https://github.com/letsencrypt/letsencrypt.git
@JPKCom
JPKCom / nginx.conf
Created February 10, 2016 15:51 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@JPKCom
JPKCom / Usage
Created February 16, 2016 11:54 — forked from input/Usage
Add a jQuery UI library to a Drupal 7 site via template.php
Usage
-----
Place the 'themename_preprocess_html()' function in your theme's template.php file.
Rename 'themename' to your theme's actual name,
e.g. for 'bartik' the function name would be changed to 'bartik_preprocess_html'.
Change 'ui.slider' to whichever jQuery UI library you want to add.
In Drupal 7, jQuery UI library files are stored in '/misc/ui'.
See: http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_library/7 for reference.