patterns 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in patterns.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Steven Chung
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Patterns
2
+ General styling patterns in SASS. Provides utility mixins for spacing, alignment and cleanup.
3
+
4
+ ## Install
5
+ ### Rails 3.1+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'patterns'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ And in your .scss file:
15
+
16
+ @import 'patterns';
17
+
18
+ ### Other
19
+ Otherwise, clone the repo and copy app/assets/stylesheets where your SASS assets should be. And in your .scss file:
20
+
21
+ @import 'some/relative/directories/patterns';
22
+
23
+ ## Use
24
+ See http://patterns-examples.herokuapp.com for functions and variables.
25
+
26
+ ### Browser Support
27
+ Tested on Chrome 23, Firefox 16 and IE8.
28
+
29
+ ## Credits
30
+ Extracted out of [hockeystick](https://www.hockeystick.co/). Thanks to [Scalability Inc.](http://www.scalability.ca/) for giving me permission to open source this.
31
+
32
+ Code inspired by the css class based version in [Placemarklist](https://www.placemarklist.com) and copied gem scaffold from [bourbon](https://github.com/thoughtbot/bourbon).
33
+
34
+ Thanks to [Luke Zhang](https://github.com/lukezhangstudio) for doing the documentation website.
35
+
36
+ ### Contribution
37
+ Feel free to fork, post issues or send any pull requests. Thanks.
38
+
39
+ ## License
40
+ MIT License
41
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,10 @@
1
+ @import 'helpers/clearfix';
2
+
3
+ @import 'alignment/center';
4
+ @import 'alignment/float';
5
+ @import 'alignment/lines';
6
+ @import 'alignment/overflow';
7
+ @import 'alignment/spacing';
8
+
9
+ @import 'widgets/clean_list';
10
+ @import 'widgets/scroll';
@@ -0,0 +1,29 @@
1
+ @mixin center {
2
+ text-align: center;
3
+ margin: 0px auto;
4
+ }
5
+ @mixin center_container {
6
+ text-align: center;
7
+ & > * {
8
+ margin: 0px auto;
9
+ }
10
+ }
11
+ /*
12
+ http://css-tricks.com/centering-in-the-unknown/
13
+ Changes the parent
14
+ */
15
+ @mixin center_container_unknown {
16
+ text-align: center;
17
+ &:before {
18
+ content: '';
19
+ display: inline-block;
20
+ height: 100%;
21
+ vertical-align: middle;
22
+ margin-right: -0.25em; /* Adjusts for spacing */
23
+ }
24
+
25
+ & > * {
26
+ display: inline-block;
27
+ vertical-align: middle;
28
+ }
29
+ }
@@ -0,0 +1,9 @@
1
+ @mixin float_left_container {
2
+ @include clearfix;
3
+ & > * { float: left; }
4
+ }
5
+ @mixin float_left_right_container {
6
+ @include clearfix;
7
+ & > :first-child { float: left; }
8
+ & > * { float: right; }
9
+ }
@@ -0,0 +1,8 @@
1
+ @mixin vertical_line_container($line_color: $line_color) {
2
+ & > :first-child { border-left: none; }
3
+ & > * { border-left: 1px solid $line_color; }
4
+ }
5
+ @mixin hortizonal_line_container($line_color: $line_color) {
6
+ & > :first-child { border-top: none; }
7
+ & > * { border-top: 1px solid $line_color; }
8
+ }
@@ -0,0 +1,10 @@
1
+ @mixin overflow_left_container {
2
+ @include clearfix;
3
+ & > :first-child { float: right; }
4
+ & > * { overflow: hidden; }
5
+ }
6
+ @mixin overflow_right_container {
7
+ @include clearfix;
8
+ & > :first-child { float: left; }
9
+ & > * { overflow: hidden; }
10
+ }
@@ -0,0 +1,38 @@
1
+ @function unit_multiplier($n, $base: $unit_base) {
2
+ @if unitless($n) {
3
+ @return $n * $base;
4
+ }
5
+ @else {
6
+ @return $n;
7
+ }
8
+ }
9
+
10
+ @mixin horizontally_spaced($n: 1) {
11
+ &:first-child { margin-left: 0; }
12
+ & { margin-left: unit_multiplier($n); }
13
+ }
14
+ @mixin vertically_spaced($n: 1) {
15
+ &:first-child { margin-top: 0; }
16
+ & { margin-top: unit_multiplier($n); }
17
+ }
18
+
19
+ @mixin horizontal_spacer_container($n: 1, $bordered: false) {
20
+ @if $bordered {
21
+ & > :first-child { margin-left: 0; padding-left: 0; }
22
+ & > * { margin-left: unit_multiplier($n, 2.5px); padding-left: unit_multiplier($n, 2.5px); }
23
+ }
24
+ @else {
25
+ & > :first-child { margin-left: 0; }
26
+ & > * { margin-left: unit_multiplier($n); }
27
+ }
28
+ }
29
+ @mixin vertical_spacer_container($n: 1, $bordered: false) {
30
+ @if $bordered {
31
+ & > :first-child { margin-top: 0; padding-top: 0; }
32
+ & > * { margin-top: unit_multiplier($n, 2.5px); padding-top: unit_multiplier($n, 2.5px); }
33
+ }
34
+ @else {
35
+ & > *:first-child { margin-top: 0; }
36
+ & > * { margin-top: unit_multiplier($n); }
37
+ }
38
+ }
@@ -0,0 +1,14 @@
1
+ //From bourbon https://github.com/thoughtbot/bourbon
2
+ @mixin clearfix {
3
+ zoom: 1;
4
+
5
+ &:before,
6
+ &:after {
7
+ content: "";
8
+ display: table;
9
+ }
10
+
11
+ &:after {
12
+ clear: both;
13
+ }
14
+ }
@@ -0,0 +1,5 @@
1
+ @mixin clean_list {
2
+ list-style-type: none;
3
+ padding: 0;
4
+ margin: 0;
5
+ }
@@ -0,0 +1,3 @@
1
+ @mixin scroll {
2
+ overflow-y: auto;
3
+ }
data/lib/patterns.rb ADDED
@@ -0,0 +1,9 @@
1
+ # inspired by https://github.com/thoughtbot/bourbon/blob/master/lib/bourbon.rb
2
+
3
+ module Patterns
4
+ if defined?(Rails) && defined?(Rails::Engine)
5
+ class Engine < ::Rails::Engine
6
+ require 'patterns/engine'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ # from https://github.com/thoughtbot/bourbon/blob/master/lib/bourbon/engine.rb
2
+ module Patterns
3
+ class Engine < Rails::Engine
4
+ # auto wire
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module Patterns
2
+ VERSION = "0.0.1"
3
+ end
data/patterns.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'patterns/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "patterns"
8
+ gem.version = Patterns::VERSION
9
+ gem.authors = ["s12chung"]
10
+ gem.email = ["steve@placemarklist.com"]
11
+ gem.description = %q{General styling patterns in SASS}
12
+ gem.summary = %q{General styling patterns in SASS for any project.}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency('sass', '>= 3.2')
21
+
22
+ gem.add_development_dependency('rake')
23
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: patterns
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - s12chung
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sass
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: General styling patterns in SASS
47
+ email:
48
+ - steve@placemarklist.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - app/assets/stylesheets/_patterns.scss
59
+ - app/assets/stylesheets/alignment/_center.scss
60
+ - app/assets/stylesheets/alignment/_float.scss
61
+ - app/assets/stylesheets/alignment/_lines.scss
62
+ - app/assets/stylesheets/alignment/_overflow.scss
63
+ - app/assets/stylesheets/alignment/_spacing.scss
64
+ - app/assets/stylesheets/helpers/_clearfix.scss
65
+ - app/assets/stylesheets/widgets/_clean_list.scss
66
+ - app/assets/stylesheets/widgets/_scroll.scss
67
+ - lib/patterns.rb
68
+ - lib/patterns/engine.rb
69
+ - lib/patterns/version.rb
70
+ - patterns.gemspec
71
+ homepage: ''
72
+ licenses: []
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.24
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: General styling patterns in SASS for any project.
95
+ test_files: []
96
+ has_rdoc: