This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var index = 1; | |
function sendMessage() { | |
var room_name = "中华网军事战略群"; | |
var message = "这是我发送的第 [" + index + "] 条信息"; | |
index ++; | |
$("#room-" + room_name).val(message); | |
setTimeout(function(){ | |
$("#room-" + room_name).trigger("input"); | |
$("button[type=submit]").click(); | |
}, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// do_sync(); | |
// do_async(); | |
// async_mode(); | |
// function: setTimeout | |
// sync | |
function do_sync() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
# postgresql apt-get repository | |
# sudo touch /etc/apt/sources.list.d/pgdg.list | |
# echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list | |
# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
# redis apt-get repository | |
echo "deb http://archive.ubuntu.com/ubuntu precise main universe" | sudo tee -a /etc/apt/sources.list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /vagrant | |
bundle | |
bundle exec rake db:create RAILS_ENV=production | |
bundle exec rake db:migrate RAILS_ENV=production | |
bundle exec sidekiq | |
rails s -p 5000 -e production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_async_data(url, callback) { | |
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.onreadystatechange = function() { | |
if (4 === xmlhttp.readyState && 200 === xmlhttp.status) { | |
// console.log(xmlhttp.response); | |
callback(JSON.parse(xmlhttp.response)); | |
} | |
} | |
xmlhttp.open("GET", url, true); | |
xmlhttp.send() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gnome-terminal\ | |
--tab\ | |
--title="Neil"\ | |
--working-directory="/home/robin/works/neil-rails-app"\ | |
-e "bash -c 'rails s -p 4000'"\ | |
--tab\ | |
--title="Front"\ | |
--working-directory="/home/robin/works/neil-rails-app/vendor/frontend"\ | |
-e "bash -c 'PORT=5000 grunt serve:proxy'"\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style='position: relative; overflow: hidden;'> | |
<div style="width:130px; height: 130px; cursor: pointer; | |
background-size: contain; | |
background-repeat: no-repeat; | |
background-position: 50% 50%;" | |
class='image' /> | |
</div> | |
<input type='file' style="position: absolute; top: 0; left: 0; margin: 0; opacity: 0; -ms-filter: 'alpha(opacity=0)'; font-size: 130px; overflow: hidden; width: 130px; height: 130px; direction: ltr; cursor: pointer;"> | |
上传最好是本人的个人照</br> | |
头像支持图像格式:jpeg, png,git,大小不超过4M<br> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function A () { | |
this.generateId(); | |
} | |
A.prototype.generateId = (function () { | |
var count = 0; | |
return function () { | |
count ++; | |
this.id = count; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Add the toolchain/test PPA* | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install g++-4.8 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 | |
*If you ever want to update symlinks for a future version:* | |
sudo rm /usr/bin/g++ | |
sudo ln -s /usr/bin/g++-4.XXX /usr/bin/g++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gnome-terminal\ | |
--tab\ | |
--title="Rails"\ | |
--working-directory="/home/username/works/project"\ | |
-e "bash -c 'rails s;bash'"\ | |
#the gnome-terminal closes after the somecommand terminates, the reason being gnome-terminal not running the bash as it's default shell. | |
#To get the bash prompt($) after the command command completes, you need to trigger it back. |
OlderNewer