This file contains hidden or 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
| <% vendor_prefixes = ['-moz-', '-webkit-', '-o-', '-ms-', ''] %> | |
| @mixin carbon { | |
| <% vendor_prefixes.each do |prefix| %> | |
| <%= "background: | |
| #{prefix}linear-gradient(63deg, #151515 5px, transparent 5px) 0 5px, | |
| #{prefix}linear-gradient(243deg, #151515 5px, transparent 5px) 10px 0px, | |
| #{prefix}linear-gradient(63deg, #222 5px, transparent 5px) 0px 10px, | |
| #{prefix}linear-gradient(243deg, #222 5px, transparent 5px) 10px 5px, | |
| #{prefix}linear-gradient(0deg, #1b1b1b 10px, transparent 10px), |
This file contains hidden or 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
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |
This file contains hidden or 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
| -- How to get all queries that has not been used by the site id 1 ? | |
| DROP TABLE IF EXISTS `queries`; | |
| SET @saved_cs_client = @@character_set_client; | |
| SET character_set_client = utf8; | |
| CREATE TABLE `queries` ( | |
| `id` int(11) NOT NULL auto_increment, | |
| `created_at` datetime default NULL, | |
| `updated_at` datetime default NULL, | |
| PRIMARY KEY (`id`) |
This file contains hidden or 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 | |
| # | |
| class Account::CreditCardController < Account::BaseController | |
| # GET /account/credit_card | |
| def edit | |
| @account = current_account | |
| @credit_card = ActiveMerchant::Billing::CreditCard.new | |
| end | |
| # PUT /account/credit_card |
This file contains hidden or 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
| <script> | |
| document.write('<script src=//' + ('__proto__' in {} ? 'cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto' : 'ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery') + '.min.js><\/script>') | |
| </script> | |
| <script> | |
| if ('__proto__' in {}) | |
| window.Zepto || document.write('<script src="assets/libs/zepto.min.js"><\/script>') | |
| else | |
| window.jQuery || document.write('<script src="assets/libs/jquery.min.js"><\/script>') | |
| </script> |
This file contains hidden or 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
| App.Example = DS.Model.extend | |
| name: DS.attr 'string' | |
| App.ExamplesController = Ember.ArrayController.extend() | |
| App.Router.map -> | |
| @resource 'examples', -> | |
| @resource 'example', path: ':example_id' | |
| App.ExamplesRoute = Ember.Route.extend |
This file contains hidden or 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 'benchmark' | |
| require 'nokogiri' | |
| n = 50000 | |
| Benchmark.bm do |x| | |
| x.report { doc = Nokogiri::HTML::DocumentFragment.parse("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.children.map{|node| node.to_s.strip}.compact.join } | |
| x.report { doc = Nokogiri::HTML::DocumentFragment.parse("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.children.each { |node| next_node = node.next_sibling ; next_node.remove if next_node && next_node.text.strip == '' } } | |
| x.report { doc = Nokogiri::HTML("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.search('p').each { |node| next_node = node.next_sibling ; next_node.remove if next_node && next_node.text.strip == '' } } | |
| end |
This file contains hidden or 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
| describe "POST to #create" do | |
| # Will use the file located at rspec/fixtures/files/test-document.pdf | |
| let(:attachement) { fixture_file_upload('/files/test-document.pdf', "text/pdf") } | |
| before do | |
| post :create, attachment: {title: "Attachment Title", attachment: file_attachment} | |
| end | |
| it {should redirect_to some_path } | |
| end |
This file contains hidden or 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
| # | |
| # Cookbook Name:: whenever | |
| # Recipe:: default | |
| # | |
| ey_cloud_report "whenever" do | |
| message "starting whenever recipe" | |
| end | |
| if node[:instance_role] == 'solo' || | |
| (node[:utility_instances].length > 0 && node[:utility_instances][0][:name] == node[:name]) || |
This file contains hidden or 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
| # | |
| # Cookbook Name:: env_vars | |
| # Recipe:: default | |
| # | |
| if ['solo', 'app', 'app_master', 'util'].include?(node[:instance_role]) | |
| execute "reload-nginx" do | |
| action :nothing | |
| command "/etc/init.d/nginx reload" |