Skip to content

Instantly share code, notes, and snippets.

View acconrad's full-sized avatar
🤓
VR to the moon

Adam Conrad acconrad

🤓
VR to the moon
View GitHub Profile
@acconrad
acconrad / mq.css
Created October 8, 2012 10:35 — forked from chriscoyier/mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
'use strict'
# App Module
angular.module('myApp', ['myFilters', 'myServices']).config ['$routeProvider', ($routeProvider) ->
$routeProvider.when('/users',
templateUrl: '<%= asset_path("leaderboard.html") %>'
controller: LeaderboardCtrl
)
]
@acconrad
acconrad / jquery-datalink.js
Created May 7, 2013 23:19
An older version of jquery-datalink
begin
@user_answer = @user.user_answers.where(:question_id => @question_id).first
if @user_answer
@user_answer.answer_id = @answer_id
@user_answer.save!
@message = 'Answer updated successfully!'
else
@user.user_answers.create(:question_id => params[:questionId], :answer_id => params[:answerId])
@message = 'Answer submitted successfully!'
end
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
class TestClass
LIST_OF_METHODS = {
1 => -> { method_1 }
2 => -> { method_2 }
}
def select_method(number)
LIST_OF_METHODS[number].call
end
@acconrad
acconrad / upto-polyfill.js
Created January 7, 2016 19:44
How to create an Array sequence from one number to the next in JavaScript
// Works in IE9+, Chrome, Safari, Firefox, and Opera
//
// Examples:
// (5).upTo(10) => [5, 6, 7, 8, 9, 10]
// (-1).upTo(3) => [-1, 0, 1, 2, 3]
Number.prototype.upTo = function( upper ){
'use strict';
var lower = this;
if ( lower == undefined ) {

Keybase proof

I hereby claim:

  • I am acconrad on github.
  • I am acconrad (https://keybase.io/acconrad) on keybase.
  • I have a public key ASAl3LMybroeC3NqsIXLB-mWaKMbrde_XaoDfzZLzlItuAo

To claim this, I am signing this object: