Skip to content

Instantly share code, notes, and snippets.

View djforth's full-sized avatar

Adrian Stainforth djforth

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Word count</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@djforth
djforth / check_geolocation.js
Last active August 29, 2015 14:08
Geolocation Blog post
if(window.navigator && window.navigator.geolocation){
// Execute Geolocation
} else {
// Fallback
}
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
libs:{
files: {
"app/assets/javascripts/lib.js": ["app/assets/javascripts/libs/*.js"]
},
@djforth
djforth / release.coffee
Created December 7, 2013 21:57
Sets a Release Date
define (require)->
_ = require('underscore')
class ReleaseDate
release:0
current_date:0
differance:0
release_id:"release_date"
@djforth
djforth / Lightbox.coffee
Created December 7, 2013 21:50
Lightbox Script
class Lightbox
lightboxID:"#lightbox"
contentID:"#content"
descriptionID:"#description"
galleryID:"#gallery-lightbox"
linksClass:".lightbox-open"
constructor:(opt, initialize=true)->
@setDefaults(opt) if _.isObject(opt)
@init() if initialize
@djforth
djforth / counter.coffee
Last active December 30, 2015 15:38
Countdown clock
class Counter
currentdate:new Date()
enddate:{}
time:{}
timedif:0
timer:0
clck:".count"
dom:{
days:"#days",
@djforth
djforth / Feature Detection
Created December 7, 2013 21:40
Feature Detection scripts
class FeatureDetect
canvas:false
geo:false
transitions:false
touch:false
constructor:(reset)->
if reset
@transitions = false
@djforth
djforth / Detection
Created November 5, 2013 22:49
Detection Scripts
class FeatureDetect
canvas:false
geo:false
transitions:false
touch:false
constructor:(reset)->
if reset
@transitions = false
def nice_asset(a,thumb=nil)
if a and a.attachment and a.attachment.url
if a.is_image?
if thumb
image = image_tag a.attachment.images.send(thumb).url, :alt=>a.title
else
image = image_tag a.attachment.url, :alt=>a.title
end
if a.linkable && a.linkable.url
link_to image, a.linkable.url

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt