This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Tracking Window Size</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tracking page title and url | |
'a' : ['_trackEvent', 'foo', document.title, window.location.url] | |
// tracking a concatenated string | |
'a' : ['_trackEvent', 'foo', document.title + ' page', 'bar'] | |
// tracking a non-interaction event - set the sixth value to true | |
'a' : ['_trackEvent', 'foo', 'bar', 'foobar', undefined, true] | |
// tracking a click on a JS interaction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.assets.precompile += [ | |
# precompile any CSS or JS file that doesn't start with _ | |
/(^inline[^_\/]|\/[^_])[^\/]*.(js|css)$/, | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
environment_seed_file = File.join(Rails.root, 'db', 'seeds', "#{Rails.env}.rb") | |
def seed_image(file_name) | |
File.open(File.join(Rails.root, "/app/assets/images/seed/#{file_name}.jpg")) | |
end | |
products = [ | |
{:name => 'foo', :description => 'lorem ipsum', :product_type => ProductType.find_by_name('Sandwiches')}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin mobile_bg($file){ | |
background-image: image-url('mobile/standard/#{$file}'); | |
@media screen and (-webkit-min-device-pixel-ratio: 2) { | |
background-image: image-url('mobile/retina/#{$file}'); | |
background-size: image-width('mobile/standard/#{$file}') image-height('mobile/standard/#{$file}'); | |
} | |
} | |
// Usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin fit_bg($url){ | |
background-image: image-url($url); | |
display: block; | |
height: image-height($url); | |
width: image-width($url); | |
} | |
// Usage | |
.nav-about { | |
@include fit_bg('assets/structure/nav/about.png'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// strip-units required by spread mixin | |
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass | |
@function strip-units($number) | |
@return $number / ($number * 0 + 1) | |
// pow and sqrt required by ease function | |
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss | |
@function pow($base, $exponent) | |
$value: $base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def view_css | |
path = "views/#{params[:controller]}/#{params[:action]}" | |
stylesheet_link_tag(path) unless Rails.application.assets.find_asset(path).nil? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
example: | |
dimension(foo, bar, 2, 10px); | |
- gets the value bar inside foo map | |
- multiplies it by two | |
- adds 10px | |
*/ | |
$dimensions: ( | |
global: ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('colors'); | |
import webpack from 'webpack'; | |
import prettysize from 'prettysize'; | |
import fs from 'fs'; | |
import { execSync } from 'child_process'; | |
import Table from 'cli-table'; | |
import config from '../config/build.js'; | |
webpack(config).run((error, stats) => { | |
if (error) console.log(error.red); |
NewerOlder