Skip to content

Instantly share code, notes, and snippets.

View atestu's full-sized avatar

Alexandre Testu atestu

View GitHub Profile
@atestu
atestu / knockout-loading.js
Last active December 18, 2015 14:39
Manage loading states in Knockout.JS! This simple trick allows you to show loading states (spinners, etc) before your data is loaded. This is very useful when you're using APIs.
var YourViewModel = function () {
var self = this;
self.thing = ko.observable('');
$.get('api/call', function (data) {
self.thing(data);
// thing is loaded,
self.loaded.thing(true);
@atestu
atestu / index.html
Last active December 17, 2015 02:38 — forked from ZJONSSON/force_labels.js
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="https://raw.github.com/d3/d3-plugins/master/force_labels/force_labels.js"></script>
<style>
.anchor { fill:blue}
.labelbox { fill:black;opacity:0.8}
.labeltext { fill:white;font-weight:bold;text-anchor:middle;font-size:16;font-family: serif}
.link { stroke:gray;stroke-width:0.35}
@atestu
atestu / gist:4945393
Created February 13, 2013 15:28
Social sharing buttons (vertical)
<div class="social-sharing">
<div class="fb-like" data-href="__YOUR_URL__" data-send="false" data-layout="box_count" data-width="55" data-show-faces="true"></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="__YOUR_URL__" data-text="__YOUR_TWEET__" data-related="__YOUR_TWITTER_ACCOUNT__" data-count="vertical">Tweet</a>
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share" data-url="__YOUR_URL__" data-counter="top"></script>
</div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
@atestu
atestu / gist:887268
Created March 25, 2011 17:53
Sends socket.io messages to the server writing on the S3 account using the knox library for node.js
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Alexandre Testu">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>