Skip to content

Instantly share code, notes, and snippets.

@bitboxx
bitboxx / gist:aff61c4cb06d5a5f1e5b536b62665cac
Last active February 15, 2017 09:07
Install Docker on CentOS 7 (and maybe higher)
# Copy paste in terminal
# Source: https://docs.docker.com/engine/installation/linux/centos/
sudo yum install -y yum-utils makecache fast
sudo yum-config-manager \
--add-repo \
https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo
sudo yum -y install docker-engine
sudo systemctl enable docker
sudo systemctl start docker
adb reboot bootloader
# Wait for device to restart
fastboot boot twrp...img
# TWRP > Advanced > Terminal
echo SYSTEMLESS=true >> /data/.supersu
# TWRP install ZIP
Open SuperSU.zip file
@bitboxx
bitboxx / hashCode.js
Created January 19, 2016 09:43
Javascript hashCode function
/**
* Javascript hashCode function
* This function is a modified version of 'Javascript implementation of Java’s String.hashCode() method'
*
* Modifications:
* - Added comments
* - Added string length caching
* - Regular function instead of String.prototype
* - Variable char (reserved word) is renamed to tmpChar.
@bitboxx
bitboxx / Javascript: trim long text
Created January 13, 2014 16:34
Trims long text and add ellipsis
// trim long text
function trimText(text, maxlength, ellipsis) {
var output = '',
i = 0;
if (text.length >= maxlength) {
ellipsis = ellipsis || '…';
text = text.split(' ');
@bitboxx
bitboxx / gist:7543206
Last active December 28, 2015 18:29
LESS: Mixins collection
.disabletextselect() {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.handcursor() {
@bitboxx
bitboxx / gist:5046552
Last active December 14, 2015 06:58
Javascript: dynamically adding CSS in to document
function loadCSS(css) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
styleElement.appendChild(document.createTextNode(css));
}
@bitboxx
bitboxx / gist:5046500
Created February 27, 2013 09:09
Javascript: basic selector (class and id)
/* remember putting / caching element in variable is faster */
/* select id with pure javascript, element by id is faster */
var bar = document.getElementById("bar");
var $el = document.querySelector('#hello');
/* select tag with pure javascript */
var $el = document.querySelector('.bye');
@bitboxx
bitboxx / gist:5017706
Created February 23, 2013 00:44
CSS: Hide text (to replace with image for example). Found here: http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@bitboxx
bitboxx / CSS: Disable text selection
Created February 12, 2013 13:34
CSS: Disable text selection
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@bitboxx
bitboxx / gist:3938446
Created October 23, 2012 12:17 — forked from omarkj/gist:986613
Lorem Ipsum
orem ipsum dolor sit amet, consectetur adipiscing elit. Etiam feugiat iaculis odio, sit amet gravida est suscipit vitae. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec rutrum, odio blandit malesuada facilisis, nibh nisl varius lacus, vitae pulvinar eros purus tincidunt enim. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris varius mauris sed tellus volutpat pharetra. Duis porta fringilla justo, non suscipit ipsum pretium eu. Morbi consequat dapibus massa eget tempor. Curabitur sed velit nec dolor elementum facilisis. In hac habitasse platea dictumst. Cras vitae justo nec purus iaculis congue. Integer consequat arcu vel ipsum hendrerit facilisis. Sed bibendum diam vitae nulla tincidunt interdum. Maecenas sagittis ligula at ipsum scelerisque a dictum erat pharetra. Cras faucibus gravida vulputate.
Ut eleifend, lectus non viverra dapibus, quam erat dignissim diam, sed porta mauris velit vitae felis. Morbi sit amet ma