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
$sprites: sprite-map("sprites/*.png"); | |
$sprites-retina: sprite-map("sprites-retina/*.png"); | |
@mixin sprite-background($name) { | |
background-image: sprite-url($sprites); | |
background-position: sprite-position($sprites, $name); | |
background-repeat: no-repeat; | |
display: block; | |
height: image-height(sprite-file($sprites, $name)); | |
width: image-width(sprite-file($sprites, $name)); |
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 map_image(lat, lng, options = {}) | |
options[:zoom] ||= '14' | |
options[:dimensions] ||= '125x125' | |
options[:sensor] ||= false | |
options[:scale] ||= '1' # Pixel density, '2' for Retina. | |
options[:marker_size] ||= 'small' | |
options[:alt] ||= '' | |
url = "http://maps.googleapis.com/maps/api/staticmap?size=#{options[:dimensions]}&zoom=#{options[:zoom]}&sensor=#{options[:sensor]}&markers=size:#{options[:marker_size]}|#{lat},#{lng}" |
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
# This assumes you use sass requires for css, not sprockets. | |
guard 'livereload' do | |
watch(%r{app/.+\.(erb|haml)}) | |
watch(%r{app/helpers/.+\.rb}) | |
watch(%r{app/assets/stylesheets/(.+\.css).*$}) { |m| "assets/#{m[1]}" } | |
watch(%r{app/assets/javascripts/(.+\.js).*$}) { |m| "assets/#{m[1]}" } | |
watch(%r{(app|vendor)/assets/.+\.(sass|scss)}) { '/assets/all/application.css' } | |
watch(%r{public/.+\.(css|js|html)}) | |
watch(%r{config/locales/.+\.yml}) |
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.configure do |env| | |
env.register_transformer 'text/ecmascript-6', | |
'application/javascript', | |
Sprockets::ES6.new('modules' => 'system', | |
'moduleIds' => true) | |
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
<div id='background'> | |
<div id='foreground'> | |
Here we have a foreground object. | |
</div> | |
</div> |
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
window.addEventListener('deviceorientation', function(eventData) { | |
// The compass direction - will return a value between 0 and 360 | |
eventData.alpha | |
// Side to side value - will return a value between -180 and 180 | |
eventData.beta | |
// Front to back value - will return a value between -90 and 90 | |
eventData.gamma | |
}); |
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 upload(filename, file_location) | |
bucket = AWS::S3::Bucket.new(ENV["AWS_BUCKET_NAME"]) | |
key = "uploads/#{SecureRandom.uuid}/#{filename}" | |
content_type = MIME::Types.type_for(filename).first.to_s | |
presigned_post = bucket.presigned_post(key: key, content_type: content_type) | |
url = presigned_post.url.to_s | |
fields = presigned_post.fields | |
`curl -i -v -X POST -F "AWSAccessKeyId=#{fields['AWSAccessKeyId']}" -F "key=#{fields['key']}" -F "policy=#{fields['policy']}" -F "signature=#{fields['signature']}" -F "Content-Type=#{content_type}" -F "file=@#{file_location + filename}" '#{url}'` | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com/canary/ember.prod.js"></script> | |
</head> |
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
# Postgres equivalent to heroku db:pull. | |
# Pulls latest heroku pgbackups dump into local database | |
# | |
# Usage: | |
# | |
# $ heroku_pg_pull [appname] [local database name] | |
# | |
function heroku_pg_pull(){ | |
echo "! WARNING: Data in the local database '$2' will be destroyed." | |
echo " Type '$2' to overwrite data in local database '$2'" |
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
import { expect } from "chai"; | |
import reducer from "../../src/reducers/workspace"; | |
import { EDIT_ITEM } from "../../src/actions/workspace"; | |
describe("workspace reducer", () => { | |
it("handles EDIT_ITEM", () => { | |
const initialState = {}; | |
const action = { | |
type: EDIT_ITEM, | |
itemIndex: 1 |