Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Treadway ntreadway

View GitHub Profile
@ntreadway
ntreadway / web.js
Created Jan 30, 2013
Express server for deploying to Heroku with Angular.
View web.js
var express = require("express"),
app = express.createServer(express.logger());
port = process.env.PORT || 3000;
app.configure(function(){
app.use(express.methodOverride());
app.use(express.bodyParser());
app.use(express.static(__dirname + '/'));
app.use(express.errorHandler({
dumpExceptions: true,
@ntreadway
ntreadway / setup.md
Last active Feb 22, 2018 — forked from aaronromeo/setup.md
Setting up Protractor tests for Ionic on CodeShip
View setup.md

Under Test Settings

'Select your technology to prepopulate basic commands' as Node.js

Setup Commands

# By default we use the Node.js version set in your package.json or the latest
# version from the 0.10 release
#
# You can use nvm to install any Node.js (or io.js) version you require.
@ntreadway
ntreadway / gist:6ebe205c84685ba070e61f8608a7fac5
Created Jun 3, 2016 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
View gist:6ebe205c84685ba070e61f8608a7fac5
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@ntreadway
ntreadway / _mixins.scss
Last active Dec 30, 2015
Hide and show Sass mixins for optimized device performance.
View _mixins.scss
@mixin show-it {
height: auto;
visibility: visible;
@include opacity(1); // Compass mixin
}
@mixin hide-it {
position: absolute;
-webkit-transform: translate3d(-9999rem,0,0);
-moz-transform: translate3d(-9999rem,0,0);
@ntreadway
ntreadway / _mixins.scss
Created Nov 18, 2013
Sass mixins for mobile first development
View _mixins.scss
// Mobile
@mixin kill-mobile-zoom {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: none;
}
@mixin kill-tap-highlight {
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
View Gemfile
source :rubygems
gem 'rake'
gem 'rack'
gem 'rack-rewrite'
gem 'thin'
gem 'sprockets', '2.2.0'
gem 'sass'
gem 'coffee-script'
@ntreadway
ntreadway / pagefailed.js.coffee.erb
Created Apr 27, 2012
Jquery page exception error for rails
View pagefailed.js.coffee.erb
<% if Rails.env.development? %>
@onLoadFailed = (event, data) ->
text = data.xhr.responseText
newHtml = text.split(/<\/?html[^>]*>/g)[1]
$("html").html newHtml
$(document).on "pageloadfailed", onLoadFailed
<% end %>
View capybara-helpers.rb
def set_mobile_agent
page.driver.header('User-Agent', 'iPhone')
end
def js_click(selector)
page.driver.execute_script "$('##{selector}').click()"
end
def screenshot
require 'capybara/util/save_and_open_page'
@ntreadway
ntreadway / page_inject.coffee
Created Apr 18, 2012
Simple page inject for JQuery Mobile and Rails Partials
View page_inject.coffee
# Used to dynamically add a rails page view when using Jquery Mobile
# Author Nick Treadway @nicktea
@insert_page = (id, content) ->
page = $("<article id="+id+" data-role='page' data-url="+id+" data-add-back-btn='true'>" + content + "</article>")
page.appendTo('body')
$('a' + '#' + id).click ->
$.mobile.changePage(page, {transition: "slide"})
# Use (your-view.haml)
View responsive-h5bp
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Your Sick Page</title>
<meta name="description" content="">