Skip to content

Instantly share code, notes, and snippets.

@craigbutcher
craigbutcher / gist:70877d9554f2ca49b173
Created January 4, 2015 21:32
Domain name configuration for NGINX + NAXSI
#######################
# Your Domain
#######################
upstream ghost_upstream_yourDomain {
server 127.0.0.1:2323;
keepalive 64;
}
server {
@craigbutcher
craigbutcher / commentRows.scss
Last active August 29, 2015 14:13
Commenting System Boxes Styling using SASS
// This is for the commenting system where we can tell SASS to run 'for' loop from 1 to variable $rows
// Using nth-child + margin-left to set the styling
// Stylus version coming soon(!)
// Variable
$rows: 10;
// For loop
@for $i from 1 through $rows {
&:nth-child(#{$i}) {
@craigbutcher
craigbutcher / Introduction:
Last active August 29, 2015 14:15
Creating ordered list with correct decimal points and alphabetical.
Influenced by [jirutka](https://gist.github.com/jirutka/32049196ab75547b7f47)
From jirutka:
Nested numbered list with correct indentation in CSS
Reused the code + added alphabetical listing.
@craigbutcher
craigbutcher / trick-numbers.js
Created February 27, 2015 14:34
JavaScript question - is it a 5 or a 6?
function myfunc(num) {
str=3;
return num;
}
var str=2;
@craigbutcher
craigbutcher / fizzbuzz.js
Created February 27, 2015 14:42
FizzBuzz?
// If you memorised this by heart and complete it in the test interview. Good for you.
// It doesn't mean squat! ;-)
for(var i = 1; i < 100; i++ ){
if( i % 3 == 0 ){
console.log("Fizz");
}
if ( i % 5 == 0 ){
@craigbutcher
craigbutcher / gist:85abbcbc48b649be1be3
Last active August 29, 2015 14:24
Accessibility Form
<div class="form-wrapper">
<form action="registered-confirmed.php" novalidate="novalidate" class="registerInterest">
<div class="row account-info">
<fieldset>
<label for="Name">Name:</label>
<input type="text" title="Name" id="Name" value="">
</fieldset>
<fieldset>
<label for="Position">Position:</label>
<input type="text" title="Position" id="Position" value="">
@craigbutcher
craigbutcher / gist:59752be0460c7776569f
Last active November 3, 2015 03:19
jQuery Validation - No Special Characters allowed (not allowing < > # )
// Thanks to this site to help out on RegEx - http://www.regexr.com/
require(["jQueryValidate"], function(){
// dont allow < > # \ /
// add alphanumeric validator
jQuery.validator.addMethod("noSpecialCharacter", function(value, element) {
var regex = new RegExp("[<>#]+");
var key = value;
@craigbutcher
craigbutcher / gist:0580b1ad947a53cab134
Last active August 29, 2015 14:25
Useful websites for web developing
RegEX - http://www.regexr.com/
jQuery Validate - http://jqueryvalidation.org/
@craigbutcher
craigbutcher / gist:3f53b6168f7bf3e45fed
Last active August 29, 2015 14:25
Fixed sidebar scrolling with stick to bottom when reach... the bottom of the page.
// Using require.js
if(has('.fixed-sidebar')) {
// Global variable to find the correct value where fixed-sidebar resides at
var setGlue = $('.fixed-sidebar').offset().top;
$(document).scroll(function(){
// Fetch the value from the browser's window
var windowTop = $(window).scrollTop();