Skip to content

Instantly share code, notes, and snippets.

View edwinwebb's full-sized avatar

Edwin Webb edwinwebb

View GitHub Profile
@edwinwebb
edwinwebb / gist:353d7a87194a357aeb77
Created November 12, 2014 10:48
Breakpoint indicator
body:before {
position: fixed;
content: "No Breakpoint";
background: white;
color:black;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
@edwinwebb
edwinwebb / gist:5155504
Last active February 1, 2019 15:39
A simple less loop with comments and simple from, to syntax.
/* Define two variables as the loop limits */
@from : 0;
@to : 10;
/* Create a Parametric mixin and add a guard operation */
.loop(@index) when(@index =< @to) {
/* As the mixin is called CSS is outputted */
div:nth-child(@{index}) {
top: unit(@index * 100, px);
@edwinwebb
edwinwebb / gist:5151220
Created March 13, 2013 11:21
Format MS to Time Stamp "MM:SS:XX" in Javascript
function formatSeconds(seconds, format) {
var ms = Math.floor((seconds*1000) % 1000);
var s = Math.floor(seconds%60);
var m = Math.floor((seconds*1000/(1000*60))%60);
var strFormat = format || "MM:SS:XX";
if(s < 10) s = "0" + s;
if(m < 10) m = "0" + m;
if(ms < 10) ms = "0" + ms;
@edwinwebb
edwinwebb / jquery.number.animation.js
Created March 13, 2013 08:51
Animate numbers with JQuery animate. Useful for animating updates to numbers.
jQuery.Animation(
{'test' : 0}, // 'element'
{'test' : 100}, // match props in 'element'
{
duration:100, //standard options
step : function(a) {
console.log(a); //step
}
}
);
@edwinwebb
edwinwebb / simpleserver.sh
Created March 12, 2013 14:45
Simple Python Server
#!/bin/bash
python -m SimpleHTTPServer
@edwinwebb
edwinwebb / gist:5143089
Created March 12, 2013 14:00
Small function for leading 0s
function (a,b){return(1e15+a+"").slice(-b)}
@edwinwebb
edwinwebb / gist:5143085
Created March 12, 2013 14:00
Small function for leading 0s
function (a,b){return(1e15+a+"").slice(-b)}
http://blog.jonnay.net/archives/423-More-ASCII-Bunnies..html
(\(\
( - -)
((') (')
(\_/)
('.')
(')(')
@edwinwebb
edwinwebb / bootstrap-login
Created November 20, 2012 15:32
Bootstrap Login form
<form action="/login" method="post" class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputEmail">Email:</label>
<div class="controls">
<input type="email" name="email" placeholder="someone@example.com" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
@edwinwebb
edwinwebb / gist:4024311
Created November 6, 2012 12:15
raty loop
$.fn.raty.defaults.click = function(s,e) {
$(this).siblings(".text").text(s);
};
<div class="star"></div><p class="text"></p>
$(".star").each(function(i) {
var target = $(this);
target.raty({scoreName: "score" + i})