Skip to content

Instantly share code, notes, and snippets.

View khusnetdinov's full-sized avatar
🏠
Working from home

Marat Khusnetdinov khusnetdinov

🏠
Working from home
View GitHub Profile
@khusnetdinov
khusnetdinov / forms.css.scss
Created February 18, 2015 16:33
Forms overloads
@import "simple_ui/import/base";
.l-page {
input, textarea, select, button {
font: #{$font-size}/#{$line-height} $font-family;
outline: none;
}
label {
// Stuff
//= require select2
@import 'global/settings';
$c-red-error-bg: #f3b1ac;
.select2-container {
@include user-select;
display: block;
margin: 5px 0 0;
//************************************************************************//
// Generate a variable ($all-text-inputs) with a list of all html5
// input types that have a text-based input, excluding textarea.
// http://diveintohtml5.org/forms.html
//************************************************************************//
$inputs-list: 'input[type="email"]',
'input[type="number"]',
'input[type="password"]',
'input[type="search"]',
'input[type="tel"]',
private static Boolean checkClonedFilesChecksum(String source, String result) throws IOException, NoSuchAlgorithmException {
String sourceChecksum = getChecksum(source);
String resultChecksum = getChecksum(result);
System.out.println("Source checksum: " + sourceChecksum);
System.out.println("Result checksum: " + resultChecksum);
return sourceChecksum.equals(resultChecksum);
}
private static String getChecksum(String fileName) throws IOException, NoSuchAlgorithmException {
MessageDigest msg = MessageDigest.getInstance("SHA1");
class Dashboard::StoreProductsController < ApplicationController
before_filter :require_login
before_action :set_auction_durations, only: [:index, :edit]
AUCTION_DURATIONS = [['1 day', 24], ['3 days', 72], ['7 days', 168], ['30 days', 720], ['90 days', 2160]]
def index
@products = current_user.products.includes(:order)
@scope = params.fetch(:scope, 'all')
# source 'https://www.npmjs.com/'
assets_path 'assets/javascripts'
asset 'angular', '1.4.3' # Angular
asset 'angular-ui-bootstrap', '0.13.3' # Booustrap UI
asset 'Chart.js', '1.0.2' # Chart.js
asset 'angular-chart.js', '0.7.3' # Directives
def index
@products = ProductsSearch.new { |instance| instance.per_page = 27 }.search do |query|
query.order()
end
end
@khusnetdinov
khusnetdinov / doc.md
Created January 20, 2016 21:12 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

@khusnetdinov
khusnetdinov / post_xml.rb
Created February 27, 2016 06:42 — forked from mattriley/post_xml.rb
Ruby HTTP POST request containing XML content
require 'net/http'
def post_xml url_string, xml_string
uri = URI.parse url_string
request = Net::HTTP::Post.new uri.path
request.body = xml_string
request.content_type = 'text/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
response.body
end
@khusnetdinov
khusnetdinov / capybara cheat sheet
Created July 15, 2016 19:27 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')