Skip to content

Instantly share code, notes, and snippets.

View blewert's full-sized avatar
:electron:
back to electron!

Benjamin Williams blewert

:electron:
back to electron!
View GitHub Profile

interpolation

//f + (t -f) * a

function interpolateTriangleSide(from, to, mouse)
{
    var percentY = (mouse.y - to.y) / (from.y - to.y);
    
    console.log(percentY);
@blewert
blewert / data_to_insert.sql
Last active August 29, 2015 14:15
sql dump
INSERT INTO `student` VALUES('S10345', 'John Smith', 'BSc Computer Science');
INSERT INTO `student` VALUES('S10346', 'Sian Evans', 'BSc Computer Science');
INSERT INTO `student` VALUES('S10347', 'Sean Crossan', 'BSc Electronic Engineering');
INSERT INTO `student` VALUES('S10348', 'Jamie McDonald', 'BSc Mathematics');
INSERT INTO `module` VALUES('CS101', 'Introduction to Computing', 10);
INSERT INTO `module` VALUES('CS203', 'Data Structures and Algorithms', 10);
INSERT INTO `module` VALUES('CS204', 'Computer Architecture', 10);
INSERT INTO `module` VALUES('M101', 'Foundation Mathematics', 20);
-- Question #1
SELECT `name`, `date_of_birth`
FROM `moviedata`.`actor`
WHERE `name` LIKE '% B%';
-- Question #2
SELECT `title`, `gross_earnings`
FROM `moviedata`.`film`
WHERE `gross_earnings` > 100000000
AND `gross_earnings` < 300000000
@blewert
blewert / complexqueries.md
Last active August 29, 2015 14:16
complex query stuff

Complex queries

Complex queries for the Advanced Java programming assignment.

Without generality:

/*!
 * Benjamin Williams <[email protected]>
 * Liam Chapman <[email protected]>
!*/

NLP Lab 3 regular expressions

// three letter words that contain only vowels
/[aeiouAEIOU]{3}/g

// three letter words that start with a vowel and end with a vowel, but have a consonant in the middle
/[aeiouAEIOU][^aeiouAEIOU\s][aeiouAEIOU]/g

// four letter words that have a consonant at the second letter but only vowels elsewhere [4 marks];

nlp lab script 3

Exercise #1

First 100 words:

>>> text6[:100]
['SCENE', '1', ':', '[', 'wind', ']', '[', 'clop', 'clop', 'clop', ']', 'KING', 'ARTHUR', ':', 'Whoa', 'there', '!', '[', 'clop', 'clop', 'clop', ']', 'SOLDIER', '#', '1', ':', 'Halt', '!', 'Who', 'goes', 'there', '?', 'ARTHUR', ':', 'It', 'is', 'I', ',', 'Arthur', ',', 'son', 'of', 'Uther', 'Pendragon', ',', 'from', 'the', 'castle', 'of', 'Camelot', '.', 'King', 'of', 'the', 'Britons', ',', 'defe
ator', 'of', 'the', 'Saxons', ',', 'sovereign', 'of', 'all', 'England', '!', 'SOLDIER', '#', '1', ':', 'Pull', 'the', 'other', 'one', '!', 'ARTHUR', ':', 'I', 'am', ',', '...', 'and', 'this', 'is', 'my', 'trusty', 'servant', 'Patsy', '.', 'We', 'have', 'ridden', 'the', 'length', 'and', 'breadth', 'of', 'the', 'land', 'in']
>>>

Castdar.cs

  • Renamed HitOBject class to HitObject
  • Angle now modulos by 360 to limit angles from 0 to 360.
navigator.geolocation.getCurrentPosition(function(loc)
{
var lat = loc.coords.latitude;
var long = loc.coords.longitude;
var acc = loc.coords.accuracy;
console.log(lat + ", " + long + ", " + acc);
});
$(document).ready(function()
{
//var articlesURL = "http://data.bbc.co.uk/bbcrd-juicer/articles.json?apikey=YB0MY3VMHyllzPqEf5alVj5bUvGpvDVi";
var articlesURL = "http://data.test.bbc.co.uk/v1/bbcrd-newslabs/creative-works?point=53.38,-1.47&radius=15km&limit=5&apikey=YB0MY3VMHyllzPqEf5alVj5bUvGpvDVi";
$.ajax({ url: articlesURL }).done(function(data)
{
//articles:
console.log(data["@graph"]);
{
"data": [
"a",
"about",
"above",
"across",
"after",
"again",
"against",
"all",