Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dbernar1's full-sized avatar

Dan Bernardic dbernar1

View GitHub Profile
@dbernar1
dbernar1 / life.coffee
Last active August 29, 2015 14:03
If internal details of a commonJS module were to be unit tested...
thereAreNo = ( items_in_array ) ->
items_in_array.length == 0
module.tests.thereAreNo: () ->
assert thereAreNo []
assert.fail thereAreNo [ 1 ]
assert.throws ->
thereAreNo 1
, /is not an array/
@dbernar1
dbernar1 / index.php
Last active August 29, 2015 13:59 — forked from stungeye/index.php
<?php
/*
* This code implements a simple higher/lower guessing game.
*
* The computer picks a random number and the user guesses by way of an HTML form.
*
* The user is given hints if they guess incorrectly with the ability to try again.
*
* Upon winning the game the user can add their name to a session-based leaderboard.
*/
@dbernar1
dbernar1 / frontend.html
Last active December 11, 2015 00:28 — forked from asuh/frontend.php
// .content contains content
<div class="content"></div>
<script>
$(document).ready(function() {
// ajax to fetch the slider data.
$.ajax({
type: 'POST',
url: '<?php echo admin_url("admin-ajax.php"); ?>',
data: { action: "front_page_slider" },
@dbernar1
dbernar1 / frontend
Last active December 11, 2015 00:19 — forked from deadlyhifi/frontend
// button to load the content
<a class="button showloadme"><span class="finger">☞</span> Who&rsquo;s this guy?</a>
// css to momentarily display loader image
.ajaxloader { width: 32px; height: 32px; background: url(ajax-loader.gif) no-repeat; margin: auto; }