• Function Key Event
  • //uncomment to prevent on startup
    //removeDefaultFunction();
    /** Prevents the default function such as the help pop-up **/
    function removeDefaultFunction()
    {
    window.onhelp = function () { return false; }
    }
    /** use keydown event and trap only the F-key,
    but not combinations with SHIFT/CTRL/ALT **/
    $(window).bind('keydown', function(e) {
    //This is the F1 key code, but NOT with SHIFT/CTRL/ALT
    var keyCode = e.keyCode || e.which;
    if((keyCode == 112 || e.key == 'F1') &&
    !(event.altKey ||event.ctrlKey || event.shiftKey || event.metaKey))
    {
    // prevent code starts here:
    removeDefaultFunction();
    e.cancelable = true;
    e.stopPropagation();
    e.preventDefault();
    e.returnValue = false;
    // Open help window here instead of alert
    alert('F1 Help key opened, ' + keyCode);
    }
    // Add other F-keys here:
    else if((keyCode == 113 || e.key == 'F2') &&
    !(event.altKey ||event.ctrlKey || event.shiftKey || event.metaKey))
    {
    // prevent code starts here:
    removeDefaultFunction();
    e.cancelable = true;
    e.stopPropagation();
    e.preventDefault();
    e.returnValue = false;
    // Do something else for F2
    alert('F2 key opened, ' + keyCode);
    }
    });

    by kevin 1 year ago 0 comments

  • Count the time
  • echo getTimeDiff("10:30","11:10");
    
    function getTimeDiff($dtime,$atime)
        {
            $nextDay = $dtime>$atime?1:0;
            $dep = explode(':',$dtime);
            $arr = explode(':',$atime);
            $diff = abs(mktime($dep[0],$dep[1],0,date('n'),date('j'),date('y'))-mktime($arr[0],$arr[1],0,date('n'),date('j')+$nextDay,date('y')));
            $hours = floor($diff/(60*60));
            $mins = floor(($diff-($hours*60*60))/(60));
            $secs = floor(($diff-(($hours*60*60)+($mins*60))));
            if(strlen($hours)<2){$hours="0".$hours;}
            if(strlen($mins)<2){$mins="0".$mins;}
            if(strlen($secs)<2){$secs="0".$secs;}
            return $hours.':'.$mins.':'.$secs;
        }



    $monday = date( 'Y-m-d', strtotime( 'monday this week' ) );
    $friday = date( 'Y-m-d', strtotime( 'friday this week' ) );
     

    by kevin 1 year ago 0 comments

  • Install the laravel on the local eviroment
  • 2. install the composer

    curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

     

    install the php 7

    curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

    https://php-osx.liip.ch/



    using laravel

    vim ~/.bash_profile
    enter 'i' to insert

    export PATH=/usr/local/php5/bin:$PATH

    PATH="$PATH:$HOME/.composer/vendor/bin"

     

    esc / enter

    :wq /enter

     

     

    by kevin 1 year ago 0 comments

  • Create a new function
  • 1. create a new table

    php artisan make:migration create_users_table
    git add.
    git commit -m "new table"
    git push origin master
    ...
    get the new file
    git pull origin master

    2. create the new view

    3. create model
    php artisan make:model User
    php artisan make:model Model/User


    newmodel and type tab

    4. create the controller

    php artisan make:controller PhotoController 


    newcontroller type tab

    5. create the interface contracts

    6. create the Eloquent


    7. add the YeposServiceProvider



     

    by kevin 1 year ago 0 comments

  • New Install Git
  • Generating a new SSH key

    1. Open Terminal.

    2. Paste the text below, substituting in your GitHub email address.

      ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
      

      This creates a new ssh key, using the provided email as a label.

      Generating public/private rsa key pair.
      
    3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.

      Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
      
    4. At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
      Enter passphrase (empty for no passphrase): [Type a passphrase]
      Enter same passphrase again: [Type passphrase again]

    Git配置SSH,并Push到GitHub上的相关流程

     

    首先,你可以试着输入git,看看系统有没有安装Git

    像上面的命令,有很多Linux会友好地告诉你Git没有安装,还会告诉你如何安装Git。

    如果你碰巧用Debian或Ubuntu Linux,通过一条sudo apt-get install git就可以直接完成Git的安装,非常简单。

    如果是其他Linux版本,可以直接通过源码安装。先从Git官网下载源码,然后解压,依次输入:./configmakesudo make install这几个命令安装就好了。

    安装完成后,还需要最后一步设置,在命令行输入:

    然后我们需要配置SSH。

    第1步:创建SSH Key。在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsaid_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:

    你需要把邮件地址换成你自己的邮件地址,然后一路回车,使用默认值即可,由于这个Key也不是用于军事目的,所以也无需设置密码。

    如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有id_rsaid_rsa.pub两个文件,这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥,可以放心地告诉任何人。

    第2步:登陆GitHub,打开“Account settings”,“SSH Keys”页面:

    然后,点“Add SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容:

    0

    点“Add Key”,你就应该看到已经添加的Key:

    10

    为什么GitHub需要SSH Key呢?因为GitHub需要识别出你推送的提交确实是你推送的,而不是别人冒充的,而Git支持SSH协议,所以,GitHub只要知道了你的公钥,就可以确认只有你自己才能推送。

    当然,GitHub允许你添加多个Key。假定你有若干电脑,你一会儿在公司提交,一会儿在家里提交,只要把每台电脑的Key都添加到GitHub,就可以在每台电脑上往GitHub推送了。

    现在,我们根据GitHub的提示,在本地的learngit仓库下运行命令:

    请千万注意,把上面的 cqcre 替换成你自己的GitHub账户名,否则,你在本地关联的就是我的远程库,关联没有问题,但是你以后推送是推不上去的,因为你的SSH Key公钥不在我的账户列表中。

    添加后,远程库的名字就是origin,这是Git默认的叫法,也可以改成别的,但是origin这个名字一看就知道是远程库。

    下一步,就可以把本地库的所有内容推送到远程库上:

    好啦,静静等待git把你的代码Push上去吧~是不是很简单?

     

    http://cuiqingcai.com/423.html

     

     

    How to access my .ssh?

    In the find file window, press Command-Shift-G. It'll ask you what folder to navigate to. Enter "~/.ssh" and press return.

     

    by kevin 1 year ago 0 comments

Recent Post

Function Key Event

Update to 5.4

new site

Intall new site

Laravel returning children of parents in same table

Count the time

Install the laravel on the local eviroment

Create a new function

Category