2017年4月28日 星期五

.bundle/cache/compact_index/rubygems.org error

I got this in few months, and can't find the solution.
after all, I found it. Just clean the cache. 
 
http://stackoverflow.com/questions/41472374/bundle-install-fails-permission-denied-rb-sysopen

rm -rf ~/.bundle/cache



There was an error while trying to write to
`/home/xxx/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions`. It is likely that you need to
grant write permissions for that path.




2017年4月27日 星期四

cs50 2016

week4
NodeList

datastructure
stack
queue

compressor

hashing table

week2
initilaize
int main(int argc, string argv[])
$ ./initials ccc  => argc ==2;
$ ./initials ccc  => argv[1]==ccc;


//這個卡了我三個小時
if(s[i] == '\0')  <--一直想這樣弄結果卡在這
if(s[i] == ' ')
{
i++;
printf("%c", toupper(s[i]));
}

http://imil.au.edu.tw/~hsichcl/TurboC/C_Unit10.htm
http://programming.im.ncnu.edu.tw/Chapter10.htm

caesar 終於卡沒那麼那麼久了  放煙火
printf("%c\n", plaintext[i]); 

#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>

int main(int argc, string argv[])
{
    if (argc == 2)
    {
    string plaintext = get_string();
    int key = atoi(argv[1]);
    // printf("plaintext:");
    // printf("%s\n",plaintext);
        for(int i = 0, n = strlen(plaintext); i < n; i++)
        {
            if(isalpha(plaintext[i]))
            {  
                if(isupper(plaintext[i]))
                {
                    int upc = (plaintext[i] + key - 65) % 26 + 65;
                    printf("%c", upc);
                }else
                {
                    int lpc = (plaintext[i] + key - 97) % 26 + 97;
                    printf("%c", lpc);
                }
            }else{
                printf("%c", plaintext[i]);
            }
        }
    }
    printf("\n");
}
 

2017年4月22日 星期六

JS30

D15
localStorage

D14
    array reference, not an array copy when use 
    const players = ['Wes', 'Sarah', 'Ryan', 'Poppy'];

    // and we want to make a copy of it.
    const team = players;

JSON-is-not-Javascript-Object
http://www.fizerkhan.com/blog/posts/JSON-is-not-Javascript-Object.html

D13
滾動超過圖片一半會跑出來

D12
addEventListener的運用('keyup',(e) =>{})

D11
這句話讓我見識到chrome的強大
webkitEnterFullScreen();

D10
with shift key

D9
console.* 教學

D8
console.xxx教學

D7
canvas 畫板,很酷

D6
Ajax search
.fetch

D5
漂亮的夾頁

D4
javascript function練習

D3
圖片CSS漸變

D2
css
    transform-origin: 100%;
    transform: rotate(90deg);
    transition: all 0.05s;
    transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1);


    const seconds = now.getSeconds();
    const secondsDegrees = ((seconds / 60) * 360 + 90);
    secondsHand.style.transform = `rotate(${secondsDegrees}deg)`;

Methods   setInterval

D1
Nodelist
http://www.w3school.com.cn/xmldom/dom_nodelist.asp

keys.forEach(key => key.addEventListener('transitionend', removeTransition));

2017年4月21日 星期五

rails 進階 base to_param overide the id rails

http://jacopretorius.net/2015/03/overriding-named-route-parameters-in-rails.html

https://apidock.com/rails/ActiveRecord/Base/to_param

http://ruby-journal.com/how-to-override-default-primary-key-id-in-rails/.

  get :products, path: 'products#show', param: :title

https://apidock.com/rails/v4.0.2/ActiveSupport/Inflector/parameterize


http://blog.teamtreehouse.com/conversational-and-short-urls-on-rails

http://ricostacruz.com/cheatsheets/rails-routes.html