Skip to content

Instantly share code, notes, and snippets.

View surfjedi's full-sized avatar
🤪

Lee Blazek surfjedi

🤪
View GitHub Profile
@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;
@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 / 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 / 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 / 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 / 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 / phonegap 2.6 android
Last active December 16, 2015 20:29
Phone Gap 2.6.0 android [your_app_name].java. With: 1.timed splash screen 2. hidden status bar
package com.[your_company_name].[your_app_name];
import android.os.Bundle;
import org.apache.cordova.*;
import android.view.WindowManager;
public class [your_app_name] extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
@surfjedi
surfjedi / good.js
Created October 10, 2013 10:14 — forked from chrisckchang/good.js
var express = require('express');
var mongodb = require('mongodb');
var logger = require('./logger.js');
var app = express();
var MONGODB_URI = 'mongodb-uri'
var db;
var coll;
// Initialize connection once, reuse the database object
@surfjedi
surfjedi / .hyper.js
Last active November 20, 2017 00:43
hyperterm settings sync
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',