Skip to content

Instantly share code, notes, and snippets.

@adewale
adewale / gist:435aa835cfa0f06004b5
Created August 7, 2015 00:28
JSON requires 1 top level object but it doesn't seem to be mentioned in the spec
Valid
[1]
Invalid
[1],[2]
Valid
[[1], [2]]
@adewale
adewale / gist:8068591
Created December 21, 2013 12:10
Flickr are changing the code for old-style embeds to allow them to flip them to the new-style embeds that can go full-screen
<iframe src="https://www.flickr.com/photos/adewale_oshineye/11477670975/player/f4cf0545f9" height="500" width="313" frameborder="0" allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>
===Before===
<div class="questionItem"><div class="QDJ_date"><p class="questionDate">Vendredi 29 novembre : Football</p><p class="questionLabel"><a href="/qdj/3152">Zlatan Ibrahimovic finira-t-il cette saison meilleur buteur de la Ligue des champions ?</a></p><div class="questionGraph"><span class="QDJ_OUI" style="width:252px;">Oui 56%</span><span class="QDJ_NON" style="width:184.5px;">Non 41%</span><span class="QDJ_NSP" style="width:18px">&nbsp;</span></div></div> <div class="nb_votes">33 307 votes</div>
<button
class="g-interactivepost"
data-contenturl="http://www.lequipe.fr/qdj/3152"
data-calltoactionlabel="VOTE"
data-calltoactionurl="http://www.lequipe.fr/qdj/3152#visuel"
data-clientid="581279799487.apps.googleusercontent.com"
data-cookiepolicy="single_host_origin"
data-prefilltext="Zlatan Ibrahimovic finira-t-il cette saison meilleur buteur de la Ligue des champions ?"
public class SingletonExample {
private static SingletonExample instance = new SingletonExample();
public static SingletonExample getInstance() {
return instance;
}
private SingletonExample() {
//Make sure they can't create another instance
}
@adewale
adewale / gist:6547709
Last active December 22, 2015 23:29
Old-style embeds
PicasaWeb:
<table style="width:194px;"><tr><td align="center" style="height:194px;background:url(https://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat left"><a href="https://picasaweb.google.com/105037104815911535953/DesignMuseum?authuser=0&feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-EOtNtxZAp5A/URhEepxTTlE/AAAAAAABqYg/o1jutbRIaj4/s160-c/DesignMuseum.jpg" width="160" height="160" style="margin:1px 0 0 4px;"></a></td></tr><tr><td style="text-align:center;font-family:arial,sans-serif;font-size:11px"><a href="https://picasaweb.google.com/105037104815911535953/DesignMuseum?authuser=0&feat=embedwebsite" style="color:#4D4D4D;font-weight:bold;text-decoration:none;">Design Museum</a></td></tr></table>
Friendfeed:
<script type="text/javascript" src="http://friendfeed.com/embed/widget/ade?v=3&amp;width=200"></script><noscript><a href="http://friendfeed.com/ade"><img alt="View my FriendFeed" style="border:0;" src="http://friendfeed.com/embed/widget/ade?v=3&amp;width=200&amp;fo
@adewale
adewale / gist:6545240
Last active December 22, 2015 23:09
A little survey of the state of the art in embeds across the web
Google+:
<!-- Place this tag in your head or just before your close body tag. -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- Place this tag where you want the widget to render. -->
<div class="g-post" data-href="https://plus.google.com/105037104815911535953/posts/UmRCitJhbGd"></div>
Facebook:
<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-post" data-href="https://www.facebook.com/photo.php?fbid=593929277310086&amp;set=a.229737897062561.56301.193742123995472&amp;type=1" data-width="550"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/photo.php?fbid=593929277310086&amp;set=a.229737897062561.56301.193742123995472&amp;type=1">Post</a> by <a href="https://www.facebook
var moment = {
'type' : 'http://schemas.google.com/AddActivity',
'target' : {
'url' : 'https://developers.google.com/+/web/snippet/examples/widget'
}
};
var request = gapi.client.request({
'path' : 'plus/v1/people/me/moments/vault',
'method' : 'POST',
@adewale
adewale / gist:891390
Created March 28, 2011 22:03
Why I changed my mind about UX and software design
Getting real: http://www.amazon.com/Getting-Real-smarter-successful-application/dp/0578012812/
Rework: http://www.amazon.com/Rework-Jason-Fried/dp/0307463745
Growing object oriented code guided by tests: http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627
Living with complexity: http://www.amazon.com/Living-Complexity-Donald-Norman/dp/0262014866
Background:
http://en.wikipedia.org/wiki/GOMS
http://www.usabilityfirst.com/usability-methods/hci-design-approaches/
http://www.alistapart.com/articles/can-you-say-that-in-english-explaining-ux-research-to-clients/
http://www.thinkoutsidein.com/blog/about/
@adewale
adewale / buzz-dlf-example.py
Created January 29, 2011 12:52
Example to verify that data can be liberated from Buzz
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#Simple searching in Buzz using the Python client
import buzz
b = buzz.Client()
r = b.search('hello')
print r.data[1].content