Skip to content

Instantly share code, notes, and snippets.

@benwong
benwong / web-app-directories.sh
Created June 2, 2019 06:07
Create directories for web app
mkdir -p {src/assets/{scss,js,images},dist}
IPublishedContent content = Umbraco.TypedContent(Model.MacroParameter["content"].ToString());
/**
script to extract calendar data from basketball fixture
*/
(function(){
function writeEvent(date, time, venue, opponent) {
let data = ['Basketball',date.replace(' (Sun)', ''), time, venue.trim(), opponent];
console.log(data.join(','));
}
@benwong
benwong / gist:67e288d4151ba9bf3697
Created April 15, 2015 06:36
Basic Responsive Grid Layout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Responsive Grid Layout</title>
<style>
.figure-grid
{
position: relative;
overflow: hidden;

Keybase proof

I hereby claim:

  • I am benwong on github.
  • I am benwong (https://keybase.io/benwong) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@benwong
benwong / domain-specific-content.html
Created April 15, 2014 05:36
Domain Specific Content
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Domain Specific Content</title>
<style>.domain-specific {display: none;}</style>
</head>
<body>
<div class="domain-specific" data-domains="['www.mydomain.com']">
<p>To go places and do things that have never been done before – that’s what living is all about.</p>
@benwong
benwong / image-urls.html
Created May 14, 2013 01:50
HTML/Javascript code to extract image URLs from web page.
<div id="output">
</div>
<script type="text/javascript">
var images = document.getElementsByTagName('img'),
i,
imageUrls = [],
imageUrlString = '';
for (i = 0; i < images.length; i++) {
@benwong
benwong / event.video.youtube.js
Created September 28, 2012 07:22
YouTube iFrame API wrapper for event videos
var EventYouTubeVideo = (function(){
var module = {};
module.init = function(){
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
@benwong
benwong / rotating-ad-banner.js
Created July 19, 2012 01:36
Javascript Rotating Ad Banner
var currentBannerIndex = 0;
var banners = [
{ image: 'banner-1.jpg', url: 'http://test.com/1' },
{ image: 'banner-2.jpg', url: 'http://test.com/2' },
{ image: 'banner-3.jpg', url: 'http://test.com/3' },
];
function getRandom(max) {
var rand = Math.random();
rand = Math.floor(rand * 1000000);
@benwong
benwong / table-columns-xml.sql
Created July 1, 2012 23:27
T-SQL to generate xml of table columns
declare @tableName varchar(50)
set @tableName = '[table_name]'
select
1 as tag,
null as parent,
table_name as [table!1!table],
null as [column!2!colname],
null as [column!2!datatype],
null as [column!2!length]