Skip to content

Instantly share code, notes, and snippets.

View fergalhanley's full-sized avatar

Fergal Hanley fergalhanley

View GitHub Profile
@fergalhanley
fergalhanley / parseQueryParameters.js
Last active May 6, 2021 05:02
Typescript/JS function for parsing a URL and returning the query parameters as an object
export const parseQueryParameters = (url) => {
const parsed = {}
const matches = url.match("\\?([^#]+)")
if (matches && matches.length >= 2) {
const query = matches[1]
query.split('&').forEach((params) => {
const frag = params.split('=')
parsed[frag[0]] = frag[1]
})
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import lombok.Data;
import org.codehaus.jackson.map.ObjectMapper;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
/**
* A easy to use class to facilitate calling the IFTTT Maker API (https://ifttt.com/maker) to trigger IFTTT recipes.
@fergalhanley
fergalhanley / vod-svg.js
Last active August 21, 2017 07:44
This AngularJS directive allows changing the color of dynamically loaded SVG files. Subject to same domain policy.
app.directive('vodSvg', function() {
return {
restrict: 'E',
replace: 'true',
template: '<object type="image/svg+xml" data=""></object>',
link: function(scope, element, attrs) {
var paintSvg = function (svgElem){
@fergalhanley
fergalhanley / index.html
Created October 18, 2013 05:43
Use this web page example to turn Google docs into a simple content manager. Create a Google Doc, publish it, copy the public link into this file and copy the file to your server. Voila! You've got a web page that will update whenever you make a change to the Google Doc.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>
My Page Title
</title>
<meta content="" name="steak" />
<link href="http://www.w3.org/StyleSheets/Core/Modernist" media="all" rel="stylesheet" type="text/css" />
<!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script><![endif]-->