Skip to content

Instantly share code, notes, and snippets.

View ntreadway's full-sized avatar

Nick Treadway ntreadway

  • Yeti Media
  • Orange County, Ca
  • X @nicktea
View GitHub Profile
@ntreadway
ntreadway / gist:bf41ca89779e01ca748d
Created May 30, 2014 18:18
ion-content scrolling fix
<ion-conent>
<div class=“list”>
<!—content—>
</div>
</ion-content>
@ntreadway
ntreadway / Angular iOS style animation panel slider
Last active August 29, 2015 14:13
Angular iOS style animation
// Slide In From Right
// -------------------------------
@-webkit-keyframes slideInFromRight {
from { -webkit-transform: translate3d(100%, 0, 0); }
to { -webkit-transform: translate3d(0, 0, 0); }
}
@-moz-keyframes slideInFromRight {
from { -moz-transform: translateX(100%); }
to { -moz-transform: translateX(0); }
@ntreadway
ntreadway / .swift
Created July 24, 2015 21:03
Unix timestamp to NSdate
for message in result.data.messages {
let json = JSON(message)
var date : NSDate!
if let messageDate = json["timetoken"].number {
let dateAsInt = messageDate as NSInteger!
let unixTime = dateAsInt / 10000000
date = NSDate(timeIntervalSince1970: NSTimeInterval(unixTime))
}
println("my date \(date)")
}
config.after_initialize do
Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new
end
#factories setup w/ cucumber.
#(env.rb)
require 'factory_girl'
Before do
require File.join(RAILS_ROOT, 'test', 'factories')
end
#Then in your (setups.rb) you can create your object using one line.
// load root vars setup URL and Code to copy
var myRoot = root;
var player:String = "http://cdn.cloudfiles.mosso.com/c38342/wc_video_player.swf"
var EmbedCode:String = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="wc_video" width="552" height="335" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">';
EmbedCode += '<param name="movie" value="'+ player +'" />';
EmbedCode += '<param name="allowScriptAccess" value="always" />';
EmbedCode += '<param name="FlashVars" value="mediaType=video&mediaSrc=' + myRoot.strSource +'&addToCanvas='+ myRoot.canvas +'&page='+ myRoot.page +'" />';
EmbedCode += '<embed src="'+ player +'" quality="high" width="552" height="335" name="Example" align="middle" play="true" loop="false" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="mediaType=video&mediaSrc=' + myRoot.strSource +'&addToCanvas='+ myRoot.canvas +'&page='+ myRoot.page +'"></em
@ntreadway
ntreadway / tabs.sass
Created August 19, 2009 06:32
Jquery tools tabs css to sass
/* root element for tabs */
ul.tabs
margin:0 !important
padding: 0
height: 30px
border-bottom: 5px solid #ddd
/* single tab */
ul.tabs li
float: left
@ntreadway
ntreadway / haml detection
Created November 13, 2010 03:34
Jquery ipad /Haml detection
- content_for :js do
- javascript_tag do
var agent=navigator.userAgent.toLowerCase();
var is_ipad = (agent.indexOf('ipad')!=-1);
if (is_ipad) {
$('body').css('-webkit-background-size', '1024px 1024px');}
@ntreadway
ntreadway / iphone-jquery-hover.rb
Created November 17, 2010 02:14
Simple iphone js onclick function to simulate :hover
- content_for :js do
- javascript_tag do
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
||(navigator.userAgent.match(/iPad/i))) {
$(".nav li a").click(function(){
$(".nav li a").removeClass("hover");
$(this).addClass("hover");
});
}
Given /^I visit subdomain "(.+)"$/ do |sub|
#host! "#{sub}.example.com" #for webrat
Capybara.default_host = "#{sub}.example.com" #for Rack::Test
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity
################################################################################
# As far as I know, you have to put all the {sub}.example.com entries that you're
# using in your /etc/hosts file for the Culerity tests. This didn't seem to be
# required for Rack::Test
################################################################################