Skip to content

Instantly share code, notes, and snippets.

View rubinchyk's full-sized avatar
🇮🇱

Alexey Rubinchyk rubinchyk

🇮🇱
View GitHub Profile
@rubinchyk
rubinchyk / triangle.scss
Last active November 3, 2015 10:50
SCSS - Triangle with border
//Triangle
&:after {
content: '';
display: block;
position: absolute;
width: 10px;
height: 10px;
background: white;
border-right: 1px solid rgba(0, 0, 0, 0.24);
border-bottom: 1px solid rgba(0, 0, 0, 0.24);
@rubinchyk
rubinchyk / element.html
Last active November 21, 2016 12:11
CSS-Animation: Border bottom filling from left to right green line.
<div>
<input class="dollar-value" type="text" />
<span class="animation-border"></span>
</div>
@rubinchyk
rubinchyk / JS: Склонение числительных ("-е", "-я", "-ий")
Last active November 21, 2016 12:10
Cклонение числительных на javascript
function declension(number, titles) {
var cases = [2, 0, 1, 1, 1, 2];
return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]];
}
var title = declension(N, ['арбуз','арбуза','арбузов']);
@rubinchyk
rubinchyk / Untitled-1
Last active November 21, 2016 09:46
Ionic1: Checking internet connection
// Checking internet connection
// Install "cordova plugin add cordova-plugin-network-information"
// states[Connection.UNKNOWN] = 'Unknown connection';
// states[Connection.ETHERNET] = 'Ethernet connection';
// states[Connection.WIFI] = 'WiFi connection';
// states[Connection.CELL_2G] = 'Cell 2G connection';
// states[Connection.CELL_3G] = 'Cell 3G connection';
// states[Connection.CELL_4G] = 'Cell 4G connection';
@rubinchyk
rubinchyk / Untitled-1
Created November 21, 2016 08:21
Ionic1: Determine back button
//Determine back button
$ionicPlatform.registerBackButtonAction(function () {
// navigator.app.exitApp();
// if (condition) {
// navigator.app.exitApp();
// } else {
// debugger;
// }
}, 100);
@rubinchyk
rubinchyk / Untitled-1
Created November 21, 2016 09:48
Angular1: Send POST request with regular 'post'
var req = {
method: 'POST',
url: 'http://',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
},
@rubinchyk
rubinchyk / Untitled-1
Created November 21, 2016 12:06
Ionic1: Disabling transitions between views
Disabling transitions between views
@rubinchyk
rubinchyk / Untitled-1
Created November 21, 2016 12:09
Ionic1: Spinner (loader icon)
// Setup the loader
$ionicLoading.show({
content: 'Loading',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 0
});
//Remove spinner
@rubinchyk
rubinchyk / Untitled-1
Last active December 4, 2016 13:45
Ionic1: Fix problem "Error code 65 for command"
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
@rubinchyk
rubinchyk / bootstrapper.ts
Created December 5, 2016 06:38
TypeScript: Order in includes typescript files to ts file
/// <reference path="vendingMachine.ts" />
var machine = new VendingMachine();