Skip to content

Instantly share code, notes, and snippets.

View jakerb's full-sized avatar
🏠
Working from home

Jake Bown jakerb

🏠
Working from home
View GitHub Profile
@jakerb
jakerb / ordinal.js
Last active September 4, 2015 14:10
Automatically adds ordinals to numbers (1,2,3 -> 1st, 2nd, 3rd)
function ordinaljs(e,t){var n=0;if(!e){var n=1;console.log("Ordinal: What should ordinal apply to?")}if(!t){var n=1;console.log("Ordinal: Set Superscript to either on or off.")}if(n!=1){$(e).each(function(){var e=$(this).text();if(t){$(this).html(e+"<sup>"+ordinal_switch(e)+"</sup>")}else{$(this).text(e+ordinal_switch(e))}})}}function ordinal_switch(e){var t=parseInt(e.slice(-1));if($.isNumeric(t)){switch(t){case 0:return"th";break;case 1:return"st";break;case 2:return"nd";break;case 3:return"rd";break;default:return"th"}}}
@jakerb
jakerb / gist:dc4c46833b0cab7b5cc4
Last active September 21, 2015 14:06
Starting with Sass

Getting started with Sass is really easy if you understand CSS, there are a small amount of changes you need to make in order understand the basics of Sass.

Using nesting

Using nesting makes writing CSS/Sass so much easier, once you get use to it, you will begin to write it naturally, the basic principle of Sass nesting is to cut down on how much you write and maintain clean, easy to read stylesheets.

A generic CSS will contain multiple class declarations which can take up a number of lines in your file; your basic CSS file may look something like this:

.wrapper {
 border: 0;
/**
* Timeago is a jQuery plugin that makes it easy to support automatically
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
*
* @name timeago
* @version 1.4.2
* @requires jQuery v1.2.3+
* @author Ryan McGeary
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
@jakerb
jakerb / routing.php
Created October 5, 2015 14:43
Dynamic Routing
<?php
/*
* @name Dynamic routing for PHP
* @author Jake Bown
* @edited 05/10/2015
* @info Set up a routing path based on a class, then use the functions as the path string (/model/view/controller).
* If you add a colon (:) after the URL, it will be passed as variable to the function.
*/
@jakerb
jakerb / app.js
Created October 9, 2015 11:31
Suited is JS library for rendering websites and apps.
/* Example Tasche Application */
tasche.init("tasche.json");
tasche.page("about", {
fullWidthHeader: {
header: "An About Page",
subheader: "Welcome to this page",
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit sint quasi explicabo!"
@jakerb
jakerb / README.md
Last active October 12, 2015 11:16
Human Readable Stylesheets

#Human Readable Stylesheets

HRSS is a jQuery class to compile CSS from sentence-like stylesheets, this was an experiment on creating website styling based on human readable and written syntax.

#Using HRSS

You can get started writing HRSS by using the following keywords: has a, and, of and have a. You can declare the styling of a selector by starting a new line \n. An example of using HRSS is given below.

@jakerb
jakerb / find.php
Last active October 28, 2015 17:04
A small PHP utility to find within a string based on a start and end point.
<?php
/*
* Small Utility to find within a string based on a start
* and end point.
* https://github.com/jakerb
* http://jakebown.com
* @jakebown1
*/
@jakerb
jakerb / jdate.js
Last active December 11, 2015 11:12
Date formatting in jQuery.
var date;
var jDate = {
init:function() {
var that = this;
date = new Date().toString();
date = date.split(' ');
},
month:function() {
@jakerb
jakerb / helpy.combo.js
Created February 15, 2016 23:53
A simple jQuery function to bind key input combinations to a function.
/*
* @author Helpy.xyz
* @version 1.0.1
* @info A simple jQuery function to bind key input combinations to a function.
* @todo Implement SHIFT, CTRL and ALT keys.
*/
var combo = {
init:function(selector) {
@jakerb
jakerb / index.html
Last active March 14, 2016 14:52
Jazz.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="jazz/css" href="style.jazz">
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script src="jazz.js"></script>
<!-- Jazz.js Demo -->