This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.graphics.Color; | |
| import android.support.design.widget.TextInputLayout; | |
| import android.text.Editable; | |
| import android.text.Layout; | |
| import android.text.SpannableStringBuilder; | |
| import android.text.Spanned; | |
| import android.text.TextWatcher; | |
| import android.text.style.AlignmentSpan; | |
| import android.text.style.ForegroundColorSpan; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix. | |
| All Clickable Views: | |
| ----------- | |
| * ripple effect (Lollipop only) -- "colorControlHighlight" | |
| Status Bar: | |
| ------------ | |
| * background (Lollipop only) - "colorPrimaryDark" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function removeEmoji($text) | |
| { | |
| $cleanText = ""; | |
| // Match Emoticons | |
| $regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; | |
| $cleanText = preg_replace($regexEmoticons, '', $text); | |
| // Match Miscellaneous Symbols and Pictographs | |
| $regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Upstart script to run a nodejs app as a service" | |
| author "Louis Chatriot" | |
| env NODE_BIN=/usr/local/bin/node | |
| env APP_DIR=/path/to/app/dir | |
| env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app | |
| env LOG_FILE=/path/to/logfile.log | |
| env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges | |
| env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...) | |
| # I typically use the environment variable NODE_ENV (see below) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The objective of this post is to get you from absolutely nothing, to a fully functional nodejs environment. | |
| Software used: Ubuntu 11.10, Nodejs v0.6.12, Nginx, MongoDB, Redis, and NPM modules. | |
| 1. Download and install the latest version of Ubuntu: http://www.ubuntu.com/download (don't select any extra items to install when prompted) | |
| 2. Once you are logged in and are at your Ubuntu command prompt, install the necessary software you will need: | |
| a. sudo apt-get install openssh-server | |
| b. sudo apt-get install libssl-dev | |
| c. sudo apt-get install git | |
| d. sudo apt-get install g++ | |
| e. sudo apt-get install make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <head> | |
| <title>Codesnippit NodeJS Twitter Tracker Client</title> | |
| </head> | |
| <body> | |
| <ul></ul> | |
| <script> | |
| (function() { | |
| var script = document.createElement("script"); | |
| script.src = "http://code.jquery.com/jquery.min.js"; |
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
- nginx is used to serve static files (css, js, images, etc.)
- node serves all the "dynamic" stuff.
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.
- nginx listens on port 80.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* jQuery selector to match exact text inside an element | |
| * http://wowmotty.blogspot.com/2010/05/jquery-selectors-adding-contains-exact.html | |
| * :containsExact() - case insensitive | |
| * :containsExactCase() - case sensitive | |
| * :containsRegex() - set by user ( use: $(el).find(':containsRegex("/(red|blue|yellow)/gi")') ) | |
| */ | |
| $.extend( $.expr[":"], { | |
| containsExact: $.expr.createPseudo ? | |
| $.expr.createPseudo(function(text) { | |
| return function(elem) { |
NewerOlder

