This file contains 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
#include <stdio.h> | |
#include <string.h> /* for memset() */ | |
#include <unistd.h> /* for usleep() */ | |
#define MAXLEN 80 | |
int main(void) { | |
int spaces = 0, | |
iterator = 1; |
This file contains 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
ini_set( 'display_errors', 1 ); | |
error_reporting( E_ALL ); |
This file contains 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> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
/** | |
* Demo for replacing checkboxes with a custom element using jQuery | |
* | |
* @author RJ Zaworski <[email protected]> | |
*/ |
This file contains 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
/** | |
* Some default styling for our new checkbox elements. We'll need to style | |
* two states -- when the box is checked (.checked) and when it isn't | |
* (no class). For both states, we'll need both a default appearance and | |
* an appearance that's used when the checkbox is being hovered over/focused | |
* on. Here goes nothing: | |
*/ | |
.p-checkbox, | |
.p-radio { | |
width:16px; |
This file contains 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(poll, timeout){ | |
var _idle = false, | |
_lastActive = 0, | |
_activeNow = function() { | |
_lastActive = new Date(); | |
if (_idle) { | |
$('#screensaver').hide(); | |
_idle = false; |
This file contains 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
# Nothin' special here: just Resig's pretty date function ported to Ruby | |
# http://ejohn.org/blog/javascript-pretty-date/ | |
def pretty_date(stamp) | |
now = Time.new | |
diff = now - stamp | |
day_diff = ((now - stamp) / 86400).floor | |
day_diff == 0 && ( | |
diff < 60 && "just now" || |
This file contains 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 | |
if (!class_exists('HerokuParser')): | |
/** | |
* A super-quick parser for Heroku logfiles | |
*/ | |
class HerokuParser { | |
/** |
This file contains 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
# Compile a list of options into an ordered array | |
def compile_options(obj, order = []) | |
components = [] | |
order = obj.keys if order.empty? | |
order.each { |k| components << obj[k] unless obj[k].blank? } | |
components | |
end | |
# Example: returns "Omaha", "Omaha, Nebraska", or "Nebraska" | |
def pretty_location(opts = {}) |
This file contains 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
def range_check(num, min, max): | |
return num <= max and num >= min; | |
print range_check(3, 0, 10) # True | |
print range_check(13, 0, 10) # False |
OlderNewer