git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| # | |
| # Install the MYSQL driver | |
| # gem install mysql2 | |
| # | |
| # Ensure the MySQL gem is defined in your Gemfile | |
| # gem 'mysql2' | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: |
This should help you get Sendmail installed with basic configuration on Ubuntu.
sudo apt-get install sendmail/etc/hosts file: nano /etc/hosts127.0.0.1 localhost yourhostnamesudo sendmailconfigsudo service apache2 restart| ======= Prolbem ================================================================================================================= | |
| I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute: | |
| rake db:create , command I get: | |
| PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) | |
| HINT: Use the same encoding as in the template database, or use template0 as template. | |
| : CREATE DATABASE "my_db_name" ENCODING = 'unicode'....... | |
| bin/rake:16:in `load' |
| package main | |
| import "strconv" | |
| import "fmt" | |
| type Color string | |
| type Make string | |
| type Model string | |
| const ( |
One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.
Let's take the example of simulating the rolling of a die.
We can represent a die as an array of its faces.
die = [*?β..?β
]
# => ["β", "β", "β", "β", "β", "β
"]This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).
Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.
Switch to the master branch and make sure you are up to date:
| # TinySegmenter 0.1 -- Super compact Japanese tokenizer in Javascript | |
| # (c) 2008 Taku Kudo <taku@chasen.org> | |
| # TinySegmenter is freely distributable under the terms of a new BSD licence. | |
| # For details, see http://lilyx.net/pages/tinysegmenter_licence.txt | |
| REGEXP_TO_CHAR_TYPES = { | |
| /[δΈδΊδΈεδΊε δΈε «δΉεηΎεδΈεε ]/ => "M", | |
| /[δΈ-ιΎ γ γγ΅γΆ]/ => "H", | |
| /[γ-γ]/ => "I", | |
| /[γ‘-γ΄γΌο½±-οΎοΎο½°]/ => "K", |
| [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] | |
| public class PreventDuplicateRequestAttribute : ActionFilterAttribute { | |
| public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { | |
| if (context.HttpContext.Request.Form.ContainsKey("__RequestVerificationToken")) { | |
| await context.HttpContext.Session.LoadAsync(); | |
| var currentToken = context.HttpContext.Request.Form["__RequestVerificationToken"].ToString(); | |
| var lastToken = context.HttpContext.Session.GetString("LastProcessedToken"); | |
| if (lastToken == currentToken) { |