Skip to content

Instantly share code, notes, and snippets.

View normansolutions's full-sized avatar

Clive Norman normansolutions

View GitHub Profile
@normansolutions
normansolutions / SchoolbaseToGoogleCalendar
Created May 7, 2013 09:38
SQL script to take Schoolbase calendar, sanitise it and make it a viable import for csv into Google Calendar. The script with take all events going back 35 days, and all future events. It will NOT include any events where the word "prov" exists int the details (as in provisional booking etc).
SELECT TOP (100) PERCENT
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(EvName, ',', ' '), '&', 'and'), '/', '-'), '', ''), '', ' '), '', ''), '"', ''''), ' ',
' ') AS subject,
LEFT(CONVERT(varchar, CONVERT(date, CalDate)), 10) AS [start date],
CONVERT(time, ISNULL(EvTime, CalDate)) AS [start Time],
LEFT(CONVERT(varchar, CONVERT(date, CalDateEnd)), 10) AS [end date],
CONVERT(time, ISNULL(EvTimeEnd, CalDateEnd)) AS [end Time],
(CASE
WHEN CONVERT(time, EvTime) IS NULL THEN 'True' ELSE 'False'
END) AS [all day event],
@normansolutions
normansolutions / sqlcalendar.config
Created May 15, 2013 09:22
Schoolbase to Firefly calendar import config file. This query will not include any events with the word "Prov" (for provisional) in the description and will also deal with events that have no end time, by creating an end time that is the start time plus 1 minute. It will also sanitise event description etc by replacing certain web unfriendly cha…
<databases>
<!-- Schoolbase Calendar -->
<database name="Schoolbase Calendar" friendlyName="Schoolbase Calendar">
<connectionString>Server=YOUR_SQL_SERVER;Database=YOUR_SCHOOLBASE_DATABASE;User ID=YOUR_DB_USERID;Password=YOUR_DB_PASSWORD;Trusted_Connection=False;</connectionString>
<!-- get categories list. Inputs NONE. Outputs: name -->
<getCategoriesQuery>
<![CDATA[
SELECT distinct(eventtype) AS [name] from Events Ev inner join EventType Et on (ev.evtypeident = et.evtypeident)
]]>
@normansolutions
normansolutions / SQL Search
Last active December 18, 2015 19:08
SQL Script to create a SP that can then be used to search for any data in any column in any table.
@normansolutions
normansolutions / EarthquakePlot.html
Last active January 2, 2016 11:49
Earthquakes on a Firefly VLE page.
<style>
#map_canvas {
max-width: 95%;
height: 350px;
border: 1px solid black;
border-radius: 5px;
box-shadow: 7px 7px 5px #888;
}
</style>
@normansolutions
normansolutions / GoogleMapScript.html
Created January 7, 2014 13:25
Google Map API Script.
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
var map;
function initialize() {
var mapOptions = {
zoom: 2,
center: new google.maps.LatLng(2.8, -187.3),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById('map_canvas'),
window.eqfeed_callback = function (results) {
var strHtml = '<ul>';
for (var i = 0; i < results.features.length; i++) {
var earthquake = results.features[i];
var coords = earthquake.geometry.coordinates;
var latLng = new google.maps.LatLng(coords[1], coords[0]);
var marker = new google.maps.Marker({
position: latLng,
map: map,
icon: getCircle(earthquake.properties.mag)
function getCircle(magnitude) {
return {
path: google.maps.SymbolPath.CIRCLE,
fillColor: 'red',
fillOpacity: .2,
scale: Math.pow(2, magnitude) / Math.PI,
strokeColor: 'white',
strokeWeight: .5
};
}
#map_canvas {
max-width: 95%;
height: 350px;
border: 1px solid black;
border-radius: 5px;
box-shadow: 7px 7px 5px #888;
}
<h1>Earthquake Map <em>(the past 24 hours)</em></h1>
<div id="map_canvas"></div>
<h2><u>Most recent events</u></h2>
<div id="earthQuake"></div>