Skip to content

Instantly share code, notes, and snippets.

View sibsfinx's full-sized avatar
😸

Alexander Mescheryakov sibsfinx

😸
View GitHub Profile
@sibsfinx
sibsfinx / example.html
Created May 19, 2013 17:41
w3schools html5 video example
<h2 class="example">Example 1</h2>
<p class="example">Create simple play/pause + resize controls for a video:</p>
<div class="example_code notranslate">
<br>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br><br>
@sibsfinx
sibsfinx / icons.h
Created May 24, 2013 13:13
some ios vector icons
//// cancel icon
{
//// Bezier 4 Drawing
UIBezierPath* bezier4Path = [UIBezierPath bezierPath];
[bezier4Path moveToPoint: CGPointMake(190.93, 36.84)];
[bezier4Path addCurveToPoint: CGPointMake(187.69, 36.84) controlPoint1: CGPointMake(190.03, 37.66) controlPoint2: CGPointMake(188.59, 37.66)];
[bezier4Path addLineToPoint: CGPointMake(182.71, 31.13)];
[bezier4Path addLineToPoint: CGPointMake(177.73, 36.84)];
[bezier4Path addCurveToPoint: CGPointMake(174.48, 36.84) controlPoint1: CGPointMake(176.82, 37.66) controlPoint2: CGPointMake(175.39, 37.66)];
class FormObjectBase < Hashie::Dash
extend ActiveModel::Naming
def persisted?; false; end
def to_key; nil; end
end
# Пример модели
class UserOrganizationForm < FormObjectBase
@sibsfinx
sibsfinx / application.html.haml
Last active December 19, 2015 06:59
scripts and stylesheets placement in layout (rails)
// https://developers.google.com/speed/docs/best-practices/rtt#PutStylesBeforeScripts
!!!
%html
%head
...
// stylesheet loads first
= stylesheet_link_tag 'application'
// main javascript file is loaded in parallel with stylesheet
= javascript_include_tag 'application'
@sibsfinx
sibsfinx / password-toggle.js.coffee
Last active December 20, 2015 01:49
password field eye icon (simple_form + js)
# app/assets/javascripts/password-toggle.js.coffee
$ ->
$(".j-password-toggle").on "click", ->
icon = $(this).find("[class*='icon']")
icon.toggleClass('fontello-icon-eye')
icon.toggleClass('fontello-icon-eye-off')
input = $(this).closest('form').find('.j-password-input')
type = input.attr("type")
if type is "text"
@sibsfinx
sibsfinx / chat-utils.js.coffee
Created July 23, 2013 11:37
scroll messages to bottom + submit by key
$ ->
submitByKey('.j-submit-by-key')
$ ->
messagesEl = $('.j-messages-list')
scrollToBottom messagesEl
$('#new_message_form')
.on 'ajax:success', (evt, data, status, xhr) ->
messagesEl.append xhr.responseText
@sibsfinx
sibsfinx / Gemfile
Created September 5, 2013 06:18
Gemfile with cocoapods
source 'http://rubygems.org'
gem 'cocoapods', '>=0.17.0.rc5'
@sibsfinx
sibsfinx / btn-transition-example.scss
Created October 17, 2013 09:21
compass css transitions example
@import "compass/css3/transition";
.btn-name {
@include transition( color 0.2s ease-in, background .2s ease-in );
}
.btn-state-1 {
color: #000;
background: #eee;
}
@sibsfinx
sibsfinx / some_view.js.coffee
Created November 12, 2013 13:57
marionette view with helpers
class App.Views.SomeView extends Marionette.ItemView
template: JST['template']
templateHelpers: -> Convead.Helpers.ApplicationHelpers
@sibsfinx
sibsfinx / segments.sass.erb
Created November 18, 2013 08:26
using Rails variables in Sass
<% predefined_colors = Settings.predefined_colors.map{ |k,v| "(#{k} #{v})" }.join(',') %>
@each $color in <%= predefined_colors %>
.segment-color-#{nth($color,1)}
background: nth($color,2)
&:hover
background: lighten(nth($color,2),3%)