Skip to content

Instantly share code, notes, and snippets.

View jochemstoel's full-sized avatar
💭
Dematerializing

Jochem Stoel jochemstoel

💭
Dematerializing
View GitHub Profile
@jochemstoel
jochemstoel / hosted_example.txt
Created May 4, 2017 19:04 — forked from makevoid/hosted_example.txt
JQuery DOM HighLighter (it's a basic "Inspect element" simple implementation to mimic what webkit inspector and firebug do)
http://uploads.makevoid.com/jquery_dom_highlighter.html
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
@jochemstoel
jochemstoel / tryWinJs.html
Created June 1, 2017 22:11 — forked from kasajian/tryWinJs.html
WinJS Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>tryWinJs</title>
<link href="winjs/css/ui-light.min.css" rel="stylesheet" />
<script src="winjs/js/base.min.js"></script>
<script src="winjs/js/ui.min.js"></script>
<style>
body{
@jochemstoel
jochemstoel / package.json
Created July 29, 2017 09:50 — forked from cvan/package.json
electron-builder settings for Moonrise
{
"devDependencies": {
"electron-builder": "^16.6.1"
},
"scripts": {
"release": "build --publish never",
"release-patch": "npm run release-win32 -- --increment patch",
"release-major": "npm run release -- --increment major",
"release-minor": "npm run release -- --increment minor",
"release-win32": "build --ia32 --publish never",
@jochemstoel
jochemstoel / background.js
Created August 6, 2017 19:18 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@jochemstoel
jochemstoel / attributes.js
Created August 7, 2017 17:36 — forked from victorono/attributes.js
All attributes element jQuery
(function(old) {
$.fn.attr = function() {
if(arguments.length === 0) {
if(this.length === 0) {
return null;
}
var obj = {};
$.each(this[0].attributes, function() {
if(this.specified) {
@jochemstoel
jochemstoel / Node.js CORS
Created September 1, 2017 00:20 — forked from nilcolor/Node.js CORS
Node.js cross-origin POST. You should response for OPTIONS request first. Something like this.
if (req.method === 'OPTIONS') {
console.log('!OPTIONS');
var headers = {};
// IE8 does not allow domains to be specified, just the *
// headers["Access-Control-Allow-Origin"] = req.headers.origin;
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
headers["Access-Control-Allow-Credentials"] = false;
headers["Access-Control-Max-Age"] = '86400'; // 24 hours
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
@jochemstoel
jochemstoel / meta-tags.md
Created September 4, 2017 07:36 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@jochemstoel
jochemstoel / hello_world.c
Created September 14, 2017 03:51 — forked from kripken/hello_world.c
Standalone WebAssembly Example
int doubler(int x) {
return 2 * x;
}
@jochemstoel
jochemstoel / readme.md
Created September 21, 2017 09:25 — forked from RaVbaker/readme.md
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d