This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Classdate form --> | |
<% if (params[:classdate] and params[:classdate][:course_id]) or @classdate.id %> | |
<%= nested_form_for(@classdate) do |f| %> | |
<% if @classdate.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@classdate.errors.count, "error") %> prohibited this classdate from being saved:</h2> | |
<ul> | |
<% @classdate.errors.full_messages.each do |msg| %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.joins(:assignments).where.not("(assignments.startdatetime > ? AND assignments.startdatetime < ?) OR (assignments.enddatetime < ? AND assignments.enddatetime > ?)", startdatetime, enddatetime, startdatetime, enddatetime) | |
# This would be fine, except it does not include users who do not have assignments at all. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// named media queries - http://blog.scur.pl/2012/06/variable-media-queries-less-css/ | |
@highdensity: ~"only screen and (-webkit-min-device-pixel-ratio: 1.5)", | |
~"only screen and (min--moz-device-pixel-ratio: 1.5)", | |
~"only screen and (-o-min-device-pixel-ratio: 3/2)", | |
~"only screen and (min-device-pixel-ratio: 1.5)"; | |
@600: ~"only screen and (min-width: 600px)"; | |
@800: ~"only screen and (min-width: 800px)"; | |
@1000: ~"only screen and (min-width: 1000px)"; | |
@1200: ~"only screen and (min-width: 1200px)"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$handle = opendir('_cache/'); | |
while (false !== ($entry = readdir($handle))) { | |
if (strlen($entry) > 2){ | |
$a = explode(".", $entry); | |
$a = explode("_", $a[0]); | |
$tstamp = intval($a[1]); | |
$t = time(); | |
if ($t > ($tstamp + 12)){ | |
// do the call, rewrite the timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="imageholder"> | |
<img src="http://3.bp.blogspot.com/-JlYXI_mJn7U/UFIJ7_8iLJI/AAAAAAAAAWY/ClZoftC59Uc/s1600/TheGobblingGluttons.jpg"> | |
<div id="glass"></div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From the 140bytes wishlist here: https://github.com/jed/140bytes/wiki/Wishlist | |
// TASK: | |
// Create a function which can create a DOM structure from this: | |
// | |
domBuilder( | |
[/HTML/], | |
[/HEAD/], | |
[/TITLE/], | |
"Wouldn't this be cool?", | |
[], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<doctype html> | |
<html> | |
<head> | |
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic' rel='stylesheet' type='text/css'> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<div id="container"> | |
<h1>The Fridge: A Startup Cultural Catalyst</h1> | |
<p>At Whiteboard, we are about culture. We're about family. We're about living <em>with</em> one another, as opposed to simply beside one another. For that reason, we recently took some time to create an internal tool.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires jQuery | |
$("h2").each(function(){ | |
var h2 = $(this); | |
var t = h2.text(); | |
var last = t.split("")[t.length-1]; | |
var newtext = t.substring(0,t.length-1) + "<span style='letter-spacing:0px;'>" + last + "</span>"; | |
h2.html(newtext); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $.relativeTime - returns a string that tells how long ago the passed in string happened. For Twitter. | |
$.relativeTime = function(dateString) { | |
var rightNow = new Date(); | |
var then = new Date(dateString); | |
if ($.browser.msie) { | |
// IE can't parse these crazy Ruby dates | |
then = Date.parse(dateString.replace(/( \+)/, ' UTC$1')); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uniqRand(notThis, range){ | |
var maybe = Math.floor(Math.random() * range); | |
if (maybe !== notThis){ | |
return maybe; | |
} else { | |
return uniqRand(notThis, range); | |
} | |
} |