Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / pass.js
Created July 27, 2012 08:02
JavaScript pass by value/reference example
var my_num = 123;
var my_str = 'abc';
var my_obj = { name: 'mark' };
var my_arr = ['a', 'b', 'c'];
var my_bool = true;
var new_num = my_num;
var new_str = my_str;
var new_obj = my_obj;
var new_arr = my_arr;
@Integralist
Integralist / 1. sinatra-basic-with-comments.rb
Last active November 9, 2019 20:10
Create basic site using Ruby and Sinatra (and external templates)
#!/usr/bin/env ruby
=begin
install Sinatra: gem install sinatra
install Shotgun: gem install shotgun (this auto-reloads sinatra on every http request - which means every time you make a change in your code you don't have to stop then start sinatra)
To just run your code using Sinatra: ruby name-of-file.rb
To run your code using Shotgun (which is just Sinatra but with ability to auto-reload when changes are made to files): shotgun name-of-file.rb
The following examples are run using Shotgun and the URL is: http://127.0.0.1:9393/
@Integralist
Integralist / ordered.md
Created May 15, 2012 10:31
Ordered Lists
ol {
	counter-reset: section;
	list-style-type: none;
}

ol li:before {
	counter-increment: section;
	content: counters(section, ".") " ";
}
@Integralist
Integralist / placeholder.js
Created April 27, 2012 15:44
HTML5 Placeholder Polyfill
var doc = document,
body = doc.body,
inputs = doc.getElementsByTagName("input"),
txtarea = doc.getElementsByTagName("textarea"),
combined = [],
len,
placeholder,
lastInputSelected;
/**
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@Integralist
Integralist / Description.md
Created April 15, 2012 09:23
Relative Sizing

If you set the <body> element to have font-size: 100% then you are effectively setting the pixel size base line to be 16px.

So now 1em equals 16px.

To size either our text or our layouts to match what the designer has specified in pixels we use the following calculation:

target / context = result

This means if your target font size for a <h1> is 24px and your 'context' (the container) is 16px then you calculate this as:

// Why you don't need arguments.callee:
var factorial = function callee(n) {
if (n === 0) {
return 1;
}
return n * callee(n - 1);
};
// In a standard compliant ES3 or ES5 implementation:
@Integralist
Integralist / README.md
Created March 27, 2012 08:58 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Object-Oriented CSS

Below is how I am currently structuring my CSS to be more object-oriented (with a little assistence from Sass):

@Integralist
Integralist / Git Workflow.md
Created March 27, 2012 08:57
Git Workflow using an organisation account with Private repositories

#Overview - setting up our git workflow This set-up works for our team as we don't mind pushing directly to a development branch, but this wouldn't work for other companies as the development branch could potentially get broken fairly quickly and with multiple developers working on this singular branch would be awkward to locate issues and fix - but for a small team this seems to work fine.

##Initial User Set-Up The first developer to work on the new project will go through this process:

  • <github>
    Create repository on GitHub company account

  • ``

@scottjehl
scottjehl / index.html
Created March 12, 2012 09:32
jQuery Mobile FixedToolbar Polyfill for non-fixed-positioning-supporting browsers (like iOS4)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fixed Toolbars Polyfill</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css">
<link rel="stylesheet" href="jquery.mobile.fixedToolbar.polyfill.css">
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>