Skip to content

Instantly share code, notes, and snippets.

View JossWhittle's full-sized avatar
😸

Joss Whittle JossWhittle

😸
View GitHub Profile
@JossWhittle
JossWhittle / Colour Bar.css
Created August 6, 2012 14:37
Colour Bar using HTML + CSS + JQuery
.colbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 7px; /* <-- Edit this to change the height */
display: table;
table-layout: fixed;
}
@JossWhittle
JossWhittle / Canvas Colour Bar.css
Created August 6, 2012 14:41
Colour Bar using HTML Canvas and Javascript
canvas { position: fixed; top: 0; left: 0; }
@JossWhittle
JossWhittle / JSONP.js
Created August 9, 2012 02:29
An example of a JSONP GET request using JQuery
$.ajax({
type: 'GET',
url: 'http://www.l2program.co.uk/ext/api/posts',
dataType: "jsonp",
data: '',
timeout: 10000,
success: function(data){
// Deal with the returned JSON stored in 'data'
},
error: function(){
@JossWhittle
JossWhittle / hosts
Created August 9, 2012 15:21
XAMPP Vhost Example
127.0.0.1 l2program.local
127.0.0.1 new.l2program.local
127.0.0.1 ie.l2program.local
127.0.0.1 cv.l2program.local
127.0.0.1 misc.local
10700662663827589367649805844573968850836838966321516650132352033753145206046940406218
89147582489792657804694888177591957484336466672569959512996030461262748092482186144069
43305123477444275027378175308757939166619214925918675955396642283714894311307469950343
95470019854326097230672901928705264472437261177158218255484911205250132014786129659313
81792235559657452039506137551467837543229119602129934048260706175397706847068202895486
90266618543512452190036948064135744747091170761976694569107009802439343961747410373691
25032313655321647736970231677550515951735184605799549194109677783732296657965816465139
03488154256310184224190259846088000110186255550245493937113651657039447629584714548523
42595042858242530608354443542821261100899286379504800689433030977321783486454311320576
56598684562886168087186938352973506439862976406600007235629179052070511640776148124918
public void p17() {
long v = 0L;
for (int i = 1; i 0) {
int digit = (int)Character.digit(a.charAt(0), 10);
if (digit == 0) {
return "and" + toword(a.substring(1));
}
3
7 4
2 4 6
8 5 9 3
int[] mlen = {0, 31,28,31,30,31,30,31,31,30,31,30,31};
String date = "";
int day = 1, month = 1, year = 1900, dotw = 1;
int count = 0;
while (!date.equals("31/12/2000")) {
date = day + "/" + month + "/" + year;
if (year > 1900 && day == 1 && dotw == 7) {
count++;
public void p20() {
String v = fact(100);
int r = 0;
for (int i = 0; i < v.length(); i++) {
r += (int)Character.digit(v.charAt(i), 10);
}
System.out.println(r);
}
public void p22() {
String[] v = {"MARY","PATRICIA","LINDA","BARBARA",...};
v = merge(v);
long sum = 0;
for (int i = 0; i < v.length; i++) {
sum += scoreWord(v[i]) * (i + 1);
}
System.out.println(sum);