Skip to content

Instantly share code, notes, and snippets.

View ivanovvitaly's full-sized avatar

Vitaly Ivanov ivanovvitaly

  • AgileEngine
  • Kharkov
View GitHub Profile
@ivanovvitaly
ivanovvitaly / chrome-web-security.sh
Created August 30, 2018 12:57 — forked from ricca509/chrome-web-security.sh
Chrome: Disable web security [OSX]
// OSX
open -na Google\ Chrome --args --disable-web-security --user-data-dir="/tmp/chrome_dev"
@ivanovvitaly
ivanovvitaly / koBootstrapSlider
Created July 8, 2015 11:17
Knockout binding handler for Bootstrap Slider
/*
How to use:
<input type="text" data-bind="bsSlider: { value: distance, min: 1, max: 100, step: 5 }"/>
Options can be removed or overriden.
*/
ko.bindingHandlers.bsSlider = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var options = ko.unwrap(valueAccessor());
@ivanovvitaly
ivanovvitaly / UIImage+RotationFix
Created July 6, 2015 20:21
UIImage category written in Swift that allows to fix the Image orientation and resize Image by long edge before uploading to the server
import Foundation
extension UIImage {
func fixOrientation() -> UIImage {
let width = CGImageGetWidth(self.CGImage)
let height = CGImageGetHeight(self.CGImage)
var transform = CGAffineTransformIdentity
var bounds = CGRect(x:0, y:0, width:width, height:height)
let scaleRatio = bounds.size.width / CGFloat(width)
@ivanovvitaly
ivanovvitaly / knockout.bindings.js
Last active July 26, 2016 13:54
My simple and usefull knockout binding handlers I always use
// Requires BlockUI
ko.bindingHandlers.blockUI = {
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var isEnabled = ko.unwrap(valueAccessor()) || false;
if (isEnabled) {
$(element).block();
}
else {
$(element).unblock();
}