Skip to content

Instantly share code, notes, and snippets.

View surfjedi's full-sized avatar
🤪

Lee Blazek surfjedi

🤪
View GitHub Profile
@surfjedi
surfjedi / ios_detect.coffee
Created September 19, 2012 02:11 — forked from rboyd/ios_detect.coffee
Detect iPhone user agent, offer app download, and javascript redirect to iTunes App Store
OFFER = 'We have an app available in the App Store! Download now?'
ITUNES_URL = '<Your iTunes URL Here>'
createCookie = (name,value,days) ->
if days
date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 365))
expires = '; expires=' + date.toGMTString()
else
expires = ''
@surfjedi
surfjedi / example_spec.js
Last active August 29, 2015 14:24
demo protractor conf and spec
describe('gloo homepage', function() {
it('Get gloo live', function() {
browser.get('https://polymer.gloo.us/');
browser.sleep(2000);
var heading = element(by.css('h1'));
expect(heading.getText()).toEqual('Grow a better You with Gloo');
});
it('Get local thru ngrok', function() {
@surfjedi
surfjedi / index.html
Last active August 29, 2015 14:22
css background-size property demo
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@surfjedi
surfjedi / random-module.js
Last active August 29, 2015 14:12
A simple random number JS module
var RandomModule = function () {};
RandomModule.prototype.getRandomArbitrary = function (min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
exports.RandomModule = RandomModule;
@surfjedi
surfjedi / 0-desc.md
Last active August 29, 2015 14:09 — forked from bajtos/0-desc.md

Imagine a chat server persisting the messages, a simplified Slack chat. The domain is designed in the object-orientated style. In order to get realtime updates, we need to transport events emitted on the model constructor ("static" events) and on a model instance ("instance" events).

While it may not be immediately clear, the example is covering few other important LoopBack concepts too:

  • authorization (loopback.token in REST)
  • current context (loopback.context in REST)

What is not covered:

  • file uploads and downloads
@surfjedi
surfjedi / css-calc.html
Created June 17, 2014 03:23
Fixed height header and footer with percentage middle section filling - css calc() example
<html>
<head>
<style>
html, body {
height: 100%;
overflow: hidden;
}
#top {
background: red;
height: 40px;