Skip to content

Instantly share code, notes, and snippets.

@grej
grej / dabblet.css
Created July 6, 2012 19:28
A "deeper" indented text effect with the :before and :after pseudo-elements.
/**
* A "deeper" indented text effect with the :before and :after pseudo-elements.
*/
html, body {
height: 100%;
}
body {
margin: 0;
@grej
grej / dabblet.css
Created July 6, 2012 19:29
Responsive Title Layout
/**
* Responsive Title Layout
* The first commented line is your dabblet’s title
*/
body{
background-color:lightgrey;
}
/*
@grej
grej / dabblet.css
Created August 17, 2012 16:18
Untitled
.box {
position: relative; /* Allows children to be absolutely positioned within box */
border: 1px solid red;
margin: 2px;
display: inline-block;
min-height:30px;
}
img.image {
position: absolute;
top: 10px;
@grej
grej / dabblet.css
Created August 21, 2012 18:19
my-dablet
/* my-dablet */
.box {
position: relative; /* Allows children to be absolutely positioned within box */
border: 2px solid red;
margin: 2px;
margin-top:10px;
margin-left:10px;
display: inline-block;
position: absolute;
@grej
grej / dabblet.css
Created August 21, 2012 19:02
multiple-resource-dablet
/* multiple-resource-dablet */
.section{
margin-left:100px;
margin-top:20px;
border:2px dotted blue;
max-width: 20%;
}
.box {
@grej
grej / xprod.r
Created September 4, 2012 18:27
R function to generate a vector cross product
# takes either a vector or one-dimensional matrix as inputs a&b
xprod <- function(a,b) {
if(length(a)==3 && length(b)==3){
getDet <- function(w,x,y,z) {
return(det(matrix(c(w,x,y,z),ncol=2)))
}
return(c(getDet(a[2],b[2],a[3],b[3]),-getDet(a[1],b[1],a[3],b[3]),getDet(a[1],b[1],a[2],b[2])))
}else{
return(FALSE)
@grej
grej / RankOrderCentroid.py
Created September 6, 2012 02:39
Rank order centroid implementation for Python
#-------------------------------------------------------------------------------
# Name: Rank Order Centroid
# Purpose: Generate rank order centroid weights
#
# Author: Greg Jennings
#
# Created: 5 Sep 2012
# Copyright: (c) Greg 2012
# Licence: MIT
#-------------------------------------------------------------------------------
@grej
grej / loadExternal.js
Created November 15, 2012 04:03
Load external js onto page
(function (document, undefined){
promptLoc = prompt('library location', "http://www.somewhere.org/lib.js");
var script = document.createElement("script");
// any script
script.src = promptLoc;
document.body.appendChild(script);
}(document));
<style>
.box {
background-color: blue;
padding: 10px;
max-width: 100px;
}
</style>
<div class="box">&nbsp;</div>
@grej
grej / _.md
Created February 12, 2014 16:33
01_04