Skip to content

Instantly share code, notes, and snippets.

View ralexandr's full-sized avatar
💭
You're never wrong to do the right thing

Alexander Radyushin ralexandr

💭
You're never wrong to do the right thing
View GitHub Profile
@ralexandr
ralexandr / SASS: Font antialias
Created October 19, 2016 09:12
SASS: Font antialias
@mixin antialias {
font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@ralexandr
ralexandr / SASS: Align vertical+horizontal
Created October 19, 2016 09:13
SASS: Align vertical+horizontal
@mixin align($vertical: true, $horizontal: false, $position: relative) {
@if $position {
position: $position;
}
@if $vertical {
top: 50%;
}
@if $horizontal {
left: 50%;
}
@ralexandr
ralexandr / SASS: Retina images
Created October 19, 2016 09:14
SASS: Retina images
/*--------------------------------
Retina images
example:
.element {
@include retina {
background-image: url(../img/background@2x.png);
}
}
*/
@ralexandr
ralexandr / SASS: Full screen width image inside container with limited width
Created October 19, 2016 09:34
SASS: Full screen width image inside container with limited width
.container {
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.full-width {
width: 100vw;
position: relative;
left: 50%;
@ralexandr
ralexandr / SASS: Button onhover background animation
Created October 19, 2016 09:37
SASS: Button onhover background animation
button {
background-image: linear-gradient(#5187c4, #1c2f45);
background-size: auto 200%;
background-position: 0 100%;
transition: background-position 0.5s;
&:hover {
background-position: 0 0;
}
}
@ralexandr
ralexandr / index.html
Created October 19, 2016 09:43
Animated input labels
<div class="container">
<form>
<h1>Sign-Up Now</h1>
<div class="field">
<label for="firstName">First Name</label>
<input type="text" id="firstName" name="firstNameTextField" placeholder="First Name">
</div>
<div class="field">
<label for="lastName">Last Name</label>
<input type="text" id="lastName" name="lastNameTextField" placeholder="Last Name">
@ralexandr
ralexandr / react-native-live-reload-xcode-settings.md
Created November 5, 2016 03:12
react-native live reload xcode settings

In the default React Native app scaffolding you have to edit AppDelegate.m to change where it loads the code if you want to test on your device. I use the following snippet to detect if it's being compiled for Debug or Production and for the Simulator or a device. For Production it uses a copy of the code included in the bundle, for Debug on the simualtor it loads from a server on localhost and for Debug on a device it loads from a server on a given IP address.

NOTE: You need to edit YOUR-IP-HERE and change it to the IP to load the code from when in Debug mode on a device. You could use a service like ngrok to make this work from anywhere.

  NSURL *jsCodeLocation;

  // Loading JavaScript code
  #if DEBUG
    // For Debug build load from development server. Start the server from the repository root:
@ralexandr
ralexandr / letsencrypt.md
Created November 22, 2016 14:41
LetsEncrypt Nginx, Apache, NodeJS

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
import { HTTPFetchNetworkInterface, printAST } from 'apollo-client';
/**
* Serialize a object to a query string
* @source https://stackoverflow.com/questions/1714786/query-string-encoding-of-a-javascript-object#comment47677757_18116302
*/
function serialize( obj ) {
return `?` + Object.keys(obj).map(k => k + `=` + encodeURIComponent(obj[k])).join(`&`);
}
@ralexandr
ralexandr / gist:750f796b70e9de1efb3e1f3ff078d1a7
Created March 28, 2018 02:00 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name