brew install node
/** | |
* Touchable Highlight example (that fires invariant as expected) | |
*/ | |
'use strict'; | |
var React = require('react-native'); | |
var { | |
AppRegistry, | |
StyleSheet, | |
Text, |
#!/bin/bash | |
# store the current dir | |
CUR_DIR=$(pwd) | |
# Let the person running the script know what's going on. | |
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n" | |
# Find all git repositories and update it to the master latest revision | |
for i in $(find . -name ".git" | cut -c 3-); do |
var Index = React.createClass({ | |
getInitialState: function () { | |
return { | |
lastPress: 0 | |
} | |
}, | |
onPress: function () { | |
var delta = new Date().getTime() - this.state.lastPress; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
In this episode we're going to be adding realtime notifications into your app using ActionCable. We've talked about notifications a few times in the past and we used AJAX polling for that. 95% of the time, polling is the solution that would be recommended for it.
But if you're looking for a good introduction into ActionCable then this is a decent one because we're only really using it for one way from the server side to the client side.
So to get started we're starting with an app that has Bootstrap installed and then we created a Main controller with an index view which is where we will list our Notifications as for this example.
Before we generate our channels let's install a few things
gpg --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 | |
gpg --armor --export 561F9B9CAC40B2F7 | sudo apt-key add - | |
sudo apt-get install apt-transport-https | |
sudo sh -c "echo 'deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main' >> /etc/apt/sources.list.d/passenger.list" | |
sudo chown root: /etc/apt/sources.list.d/passenger.list | |
sudo chmod 600 /etc/apt/sources.list.d/passenger.list | |
sudo apt-get update | |
sudo apt-get install nginx-full passenger |
To enable the precompilation of all non.js/.css assets within vendor/assets
just add this to config/initializers/assets.rb
:
Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }
Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.
If you need to precompile images only, you could use this:
Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)