Skip to content

Instantly share code, notes, and snippets.

@likerRr
likerRr / 0_reuse_code.js
Created July 29, 2014 08:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@likerRr
likerRr / dot-notation-object.js
Last active October 31, 2016 12:48
Adding string with dot-notation as a key to JavaScript objects
// Be careful when changing Object's prototype to avoid overwriting of methods
if (Object.prototype.setPath === undefined && Object.prototype.getPath === undefined) {
Object.prototype.setPath = function (path, value, notation) {
function isObject(obj) { return (Object.prototype.toString.call(obj) === '[object Object]' && !!obj);}
notation = notation || '.';
path.split(notation).reduce(function (prev, cur, idx, arr) {
var isLast = (idx === arr.length - 1);
// if <cur> is last part of path
if (isLast) return (prev[cur] = value);
@likerRr
likerRr / hedisql-ssh-connect
Created April 16, 2015 21:53
How to connect to HediSQL via ssh
proof: http://www.heidisql.com/forum.php?t=167
---------------------------------------------------------------------------------------------
I just tried to connect to my MySQL using putty.. It works great...
First download Putty (google on putty) then create a new connection.
Go to "Connection -> SSH -> Tunnels" in the left part of the screen and input the following:
Source port: 3306
Destination: localhost:3306
(The radiobuttons stay on "local" and "auto")
Then press the "Add" button.
@likerRr
likerRr / jquery_horizontal_scroll
Created May 8, 2015 07:56
jQuery horizontal scroll
$('#el').bind('DOMMouseScroll mousewheel', function(e) {
var step = 30;
e.preventDefault();
step *= (e.originalEvent.wheelDelta > 0) ? -1 : 1;
$(this).scrollLeft($(this).scrollLeft() + step);
});
@likerRr
likerRr / Ripple Button.html
Last active August 29, 2015 14:27
jquery-epulse Ripple Button
<button id="ripple-button">Ripple button</button>
@likerRr
likerRr / Rain Effect.html
Last active August 29, 2015 14:27
jquery-epulse Rain Effect
<div id="rain-container"></div>
@likerRr
likerRr / README.me
Created September 25, 2015 14:18
Vagrant shared symlinks setup
Solves problem between windows (host) and linux (vagrant), when there are symlinks in shared folders at linux machine.
With this config symlinks will search at the machine, where they were created
@likerRr
likerRr / hypenate.css
Created September 28, 2015 07:08
Right way to hyphenate long words in CSS
// https://justmarkup.com/log/2015/07/31/dealing-with-long-words-in-css/
.hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
@likerRr
likerRr / 020_add_android_permissions.js
Last active August 21, 2020 18:24
Add permissions to AndroidManifest.xml with cordova hook for Ionic 2
/*
This script uses as a cordova hook and provides ability to add android permissions to AndroidManifest.xml on the fly. It also
checks and computes which of provided permissions are already added and didn't rewrite AndroidManifest.xml if no permissions provided.
Executes only for android platform.
Prerequirements:
- node 4.2+
- npm modules: lodash, xml2js
Distributed under the MIT license.
@likerRr
likerRr / font-weight-names
Created January 3, 2017 07:04
Usual names for `font-weight` CSS property
// http://www.webtype.com/info/articles/fonts-weights/
100 Extra Light, Ultra Light
200 Light or Thin
300 Book or Demi
400 Normal or Regular
500 Medium
600 Semibold, Demibold
700 Bold
800 Black, Extra Bold or Heavy
900 Extra Black, Fat, Poster or Ultra Black