Skip to content

Instantly share code, notes, and snippets.

View samccone's full-sized avatar
🐐

Sam Saccone samccone

🐐
  • Google
  • ∆∆∆<script>alert(prompt('why'))</script>
  • X @samccone
View GitHub Profile
@samccone
samccone / connect4.rb
Created August 24, 2011 03:12
connect4
class String
def is_i?
!!(self =~ /^[-+]?[0-9]+$/)
end
end
class Board
def initialize(rows,columns)
@theBoard = Hash.new
@rows = rows
@samccone
samccone / gist:1653975
Created January 21, 2012 20:56
HTML5 Enter Full Screen Shim
// detecting if browser supports fullscreen
return document.body.mozRequestFullScreen || document.body.webkitRequestFullScreen || document.body.requestFullScreen;
// requesting full screen on an elm
( elm.mozRequestFullScreen && elm.mozRequestFullScreen() ) || ( elm.webkitRequestFullScreen && elm.webkitRequestFullScreen() ) || ( elm.requestFullScreen && elm.requestFullScreen() );
//binding to full screen event
( document.body.requestFullScreen && window.addEventListener('fullscreenchange',fullScreenEvent) ) || ( document.body.webkitRequestFullScreen && window.addEventListener('webkitfullscreenchange',fullScreenEvent ) ) || ( document.body.mozRequestFullScreen && window.addEventListener('mozfullscreenchange',fullScreenEvent) );
@samccone
samccone / gist:1700590
Created January 29, 2012 20:53
CSS3 HTML5 fullscreen selectors
#elm:-webkit-full-screen, #elm:-moz-full-screen,#elm:full-screen {
height: 100%;
width: 100%;
position: absolute;
background-color:#000;
}
@samccone
samccone / gist:2470939
Created April 23, 2012 13:27
JS Templating Languages
http://icanhazjs.com/
http://mustache.github.com/
https://github.com/nje/jquery-tmpl
http://documentcloud.github.com/backbone/
http://handlebarsjs.com/
http://akdubya.github.com/dustjs/
https://github.com/creationix/haml-js
@samccone
samccone / dabblet.css
Created April 24, 2012 02:29
Untitled
body {
background-color:#DDD
}
.green {
background: #2eb760;
background: -moz-linear-gradient(top, #2eb760 0%, #1b9746 71%, #199540 88%, #1b9a35 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2eb760), color-stop(71%,#1b9746), color-stop(88%,#199540), color-stop(100%,#1b9a35));
background: -webkit-linear-gradient(top, #2eb760 0%,#1b9746 71%,#199540 88%,#1b9a35 100%);
background: -o-linear-gradient(top, #2eb760 0%,#1b9746 71%,#199540 88%,#1b9a35 100%);
.pill {
height: 30px;
width: 70px;
overflow: hidden;
position: relative;
}
.pill .section.right {
border-radius: 0px 10px 10px 0px;
}
@samccone
samccone / gist:2918163
Created June 12, 2012 15:21
fixing newb problems
window.onload = ->
img = new Image()
img.src = '600.jpeg'
img.onload = ->
el = document.getElementById('stage')
ctx = el.getContext('2d')
el.setAttribute 'width', img.width
el.setAttribute 'height', img.height
ctx.drawImage img, 0, 0
@samccone
samccone / gist:2919791
Created June 12, 2012 20:02
JS Style
// CONDITIONALS
if (foo && bar) {
}
if () {
} else {
}
body {
background-color:#111;
color: #FFF;
}
.foo {
opacity: 0.9
}
.bar {
body {
background-color:#111;
color: #FFF;
}
.foo {
opacity: 0.9
}
.bar {