Skip to content

Instantly share code, notes, and snippets.

View cpjobling's full-sized avatar

Chris P. Jobling cpjobling

View GitHub Profile
@cpjobling
cpjobling / gist:5394966
Created April 16, 2013 10:40
Files added to rails by the backbone-on-rails gem.
tree .
.
:
├── app
│   ├── assets
│   │   ├── javascripts
│   │   │   ├── application.js
│   │   │   ├── collections
│   │   │   ├── models
│   │   │   ├── pselectr.js
@cpjobling
cpjobling / application.js
Created April 16, 2013 10:35
Rails JavaScript manifest file generated by the backbone-on-rails gem. Extracted from the result of: bundle exec rails g backbone:install
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
@cpjobling
cpjobling / app_name.js
Last active December 16, 2015 06:58
Backbone on rails initializer. Extracted from the JavaScript generated from app_name.js.coffee thatw as generated by running the `backbone-on-rails` command bundle exec rails g backbone:install
(function() {
window.Pselectr = {
Models: {},
Collections: {},
Views: {},
Routers: {},
init: function() {
alert('Hello from Backbone')
}
};
@cpjobling
cpjobling / cs5.php
Created May 21, 2012 10:27
An example of server-side validation in PHP
<! --
EG-259 Examinations 2012
Case Study 5
A Registration Form with Server-side Validation using PHP
-->
<?php
# Client-side validation functions
function validateName($name) {
//if it's NOT valid
@cpjobling
cpjobling / general.css
Created May 21, 2012 10:08
Style sheet example
@CHARSET "UTF-8";
/******* GENERAL RESET *******/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
border: 0pt none;
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
margin: 0pt;
padding: 0pt;
@cpjobling
cpjobling / validation.js
Created May 21, 2012 10:05
Syntax highlighted source code example
/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!
/***************************/
jQuery(document).ready(function() {
//global vars
var form = $("#customForm");
@cpjobling
cpjobling / q4c_correction_2010.m
Created May 4, 2012 15:08
EGLM03 Exam 2009-10: Correction to Q4(c) calculation of observer gains using Ackermann's formula
%% EGLM03 Exam 2009-10: Q4(c) Correction.
% Define system to be observed (controller canonical form)
A = [-13, -39, -27; 1, 0, 0; 0, 1, 0];
B = [1; 0; 0];
C = [0,5,2];
% Design of an observer using Ackermann's formula
At = A';
Ct = C';
Obs = [Ct, At * Ct, (At)^2 * Ct];
ObsI = inv(Obs)
@cpjobling
cpjobling / q4c_correction_2011.m
Created May 4, 2012 15:00
Solving EGLM03 Exam Q4(c) with Matlab using Ackermann's formula for a state observer
%% EGLM03 Exam 2010-11: Q4(c) Correction.
% Define system to be observed (controller canonical form)
A = [-10, -25, 0; 1, 0, 0; 0, 1, 0];
B = [1; 0; 0];
C = [0,1,2];
% Design of an observer using Ackermann's formula
At = A';
Ct = C';
Obs = [Ct, At * Ct, (At)^2 * Ct];
ObsI = inv(Obs)
@cpjobling
cpjobling / html5-template.html
Created March 6, 2012 20:28
Simple bare-minimum HTML5 template (no CSS, no JavaScript)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>...</title>
</head>
<body>
</body>
</html>
@cpjobling
cpjobling / html5_template.html
Created February 16, 2012 20:07
Basic HTML5 template
<!DOCTYPE html>
<html lang="en">
<head>
<title>An HTML5 standard template</title>
<meta charset="utf-8" />
<link rel="stylesheet" media="screen" href="nostyle.css" />
</head>
<body>