tar -zcvf tar-archive-name.tar.gz source-folder-name
tar -zxvf tar-archive-name.tar.gz
import "package:flutter/material.dart"; | |
import 'package:flutter/services.dart'; | |
import 'dart:math'; | |
const CURVE_HEIGHT = 160.0; | |
const AVATAR_RADIUS = CURVE_HEIGHT * 0.28; | |
const AVATAR_DIAMETER = AVATAR_RADIUS * 2; | |
void main() => runApp(new MyApp()); |
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
Dont misuse predicate methods: | |
------- | |
predicate methods used to return either true or false. they ends with "?" | |
It’s been a while since we’ve rolled out our previous article about the most common Rails mistakes that beginner developers usually make. In this regard, we aren’t going to bother you with too much of introduction and get straight to the point. This article will be dedicated to the standard approaches to Ruby development which are also called “the Ruby way”. As usual, the most critical mistakes are highlighted with RED. So, let’s find out what exactly newbies do wrong/forget to do or don’t do at all. | |
They misuse predicates | |
A predicate is a method that answers a specific question and always returns either “yes” or “no”. It’s not supposed to affect any other piece of code or perform any additional actions. According to the Ruby on Rails style guides, predicates are followed by a question mark at the end of the method name. | |
############ | |
## WRONG ## |
<template> | |
<file-input v-model="filename" @formData="formData"> | |
<v-btn @click.native="uploadFiles"> | |
</template> | |
<script> | |
import fileInput from './file-input.vue' | |
export default{ | |
components:{fileInput} |
JavaScript is great, but comparing to other programing languages it has many confusing parts. One of them is the use of this.
In this blog post I will explain how to use it right, and what are the tools that JavaScript provide us to ease the use of it. In the end, I will focus on react.
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
gem 'rails_12factor'
to your Gemfile. This will add error logging and the ability for your app to serve static assets.bundle
RAILS_ENV=production rake db:create db:migrate db:seed
rake secret
and copy the outputexport SECRET_KEY_BASE=output-of-rake-secret
rake assets:precompile
. This will create a folder public/assets
that contains all of your assets.RAILS_ENV=production rails s
and you should see your app.Remember to clobber your assets (rake assets:clobber
) and re-precompile (rake assets:precompile
) if you make changes.