Skip to content

Instantly share code, notes, and snippets.

View seb-thomas's full-sized avatar
💭
😷

Sebastian Thomas seb-thomas

💭
😷
View GitHub Profile
@seb-thomas
seb-thomas / update
Last active December 13, 2015 21:38 — forked from tomviner/updated?
var dateUpdated = "";
var reDate = /(\d+)\/(\d+)\/(\d+)/;
var titleDate = jQuery('p.author a').last().attr('title');
var favi = jQuery('[rel="shortcut icon"]');
//Swap year and day, convert to Date obj
titleDate = (titleDate).replace(reDate, "$3/$2/$1");
titleDate = new Date(titleDate);
function changeTitle() {
jQuery.get(
@seb-thomas
seb-thomas / updated?
Created February 18, 2013 16:29
Some js to help us see if a page has been updated while we've been staring at it like zombied smack addicts.
var YOUR_API_KEY = ''
var dateUpdated = "";
function changeTitle() {
var favi = jQuery('[rel="shortcut icon"]');
var titleDate = jQuery('p.author a').last().attr('title');
var reDate = /(\d+)\/(\d+)\/(\d+)/;
//Swap year and day, convert to Date obj
titleDate = (titleDate).replace(reDate, "$3/$2/$1");
@seb-thomas
seb-thomas / gist:4976998
Created February 18, 2013 12:24
date swap gist
var myRe = /(\d+)\/(\d+)\/(\d+)/;
('15/02/2013 05:12 pm').replace(myRe, "$3/$2/$1");
"2013/02/15 05:12 pm"
In [2]: run image_script.py
File "<ipython-input-2-f82209390f2b>", line 1
run image_script.py
^
SyntaxError: invalid syntax
In [3]: run image_script
File "<ipython-input-3-556c636d0b48>", line 1
run image_script
{"msg": "1 item was added to your basket", "item": {"original_price": "60.00", "name": "era ca", "url": "/store/product/vans-era-ca-trainers-VN-0IM96GW", "brand": "Vans", "qty": 1, "selling_price": "60.00", "thumb_url": ""}, "cart_total": "420.00", "cart_item_count": 7}
$.getJSON('media/js/markers.json', function(data){
$.each(data.markers, function(i, marker){
if (marker.tag = "foo") {
map.addMarker({
id: i,
tags: marker.tag,
lat: marker.latitude,
lng: marker.longitude,
infoWindow: {
content: '<h2>' + marker.name + '</h2><p>' + marker.address + '</p>'
@seb-thomas
seb-thomas / gist:4285197
Created December 14, 2012 12:38
set marker from json
$.getJSON('media/js/markers.json', function(data){
$.each(data.markers, function(i, marker){
map.addMarker({
id: i,
tags: marker.tag,
lat: marker.latitude,
lng: marker.longitude,
infoWindow: {
content: '<h2>' + marker.name + '</h2><p>' + marker.address + '</p>'
}
@seb-thomas
seb-thomas / gist:4275923
Created December 13, 2012 11:46
Maps Robot Todo
- Geolocation (doesnt seem to be workin on mobile)
- Click pin for more info
- Filter pins
- Add pins easily
- Move to cherrypy
- Pretty up interface
@seb-thomas
seb-thomas / Arguments
Created November 23, 2012 17:39
Arguments
function changeSeasons() {
updateSeason('#spring', 'gray', 'Winter');
updateSeason('#summer', 'orange', 'Autumn');
function updateSeason(sourceSeason, colour, name) {
var element = $(sourceSeason);
var newColour = colour;
var newName = name;
element.css('background-color', newColour);
@seb-thomas
seb-thomas / gist:3981525
Created October 30, 2012 16:58
more than one table
class Shoe(Base):
"""
Container class for our SQLAlchemy object that is actually
from the thbookdata django app model
"""
__tablename__ = 'bookdata_shoe'
__table_args__ = {'autoload': True}