This file contains 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
jQuery('element').livequery(function(){ | |
//element available now. | |
}); |
This file contains 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
# partial '_list_form.html.erb' | |
<%= form_tag('/controller/action', method: :post) do %> | |
<% left.each do |left_label| %> | |
<%= label_tag "field[#{left_label}]", left_label %> | |
<%= select("field", left_label, right, { include_blank: true }) %> | |
<% end %> | |
<%= submit_tag "Submit" %> | |
<% end %> |
This file contains 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
require 'rest-client' | |
require 'base64' | |
RestClient::Request.execute(url: 'ENDPOINT', method: :get, headers:{Authorization: "Basic #{Base64.encode64('USERNAME:PASSWORD')}"}) |
This file contains 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
def escape_string str | |
str.gsub!(/\"/,'\\u0022') if str.include? '"' | |
str.gsub!(/\'/,'\\u0027') if str.include? "'" | |
str.gsub!(/\,/,'\\u002C') if str.include? "," | |
str | |
end |
This file contains 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
require 'active_support/core_ext/hash/conversions' | |
Hash.from_xml XML_STRING |
This file contains 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
/* | |
1. Download latest version of Selenium Standalone Server from http://selenium-release.storage.googleapis.com/index.html | |
2. Run java -jar selenium-server-standalone-2.53.1.jar -port 8910 | |
3. Replace the file name with your JAR file name. | |
4. Download phantomjs from http://phantomjs.org/download.html and set the path to access it from anywhere in the machine. | |
Note: Refer https://www.npmjs.com/package/selenium-webdriver for nodejs. | |
*/ | |
var webdriver = require('selenium-webdriver'); //npm install selenium-webdriver | |
var proxy = '127.0.0.1'; |
This file contains 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
Follow Link for installation: https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-ubuntu/ | |
After installation | |
1. sudo service mongod stop | |
2. sudo vi ~/etc/mongod.conf | |
3. update #engine: to engine: wiredTiger | |
4. sudo rm -rf /var/lib/mongodb/* | |
5. sudo rm -rf /var/log/mongodb/* | |
6. sudo service mongod start | |
7. check using db.serverStatus().storageEngine on mongo. |
This file contains 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 Horseman = require('node-horseman'); | |
var horseman = new Horseman(); | |
horseman | |
.open('http://httpbin.org/ip') | |
.setProxy('http://api-key:@proxy.crawlera.com:8010') //change the proxy before use. | |
.html('body') | |
.then(function(body) { | |
console.log(body); | |
}); |
This file contains 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 Horseman = require('node-horseman'); | |
var horseman = new Horseman(); | |
var apiKey = '' //upated the api key. | |
horseman | |
.authentication(apiKey, '') | |
.open('http://proxy.crawlera.com:8010/fetch?url=https://httpbin.org/ip') | |
.html('body') | |
.then(function(body) { |
This file contains 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
brew tap killercup/homebrew-openresty | |
brew install openresty | |
brew services start homebrew/nginx/openresty | |
brew services stop homebrew/nginx/openresty | |
Installation Errors: | |
******** OpenSSL error(default) ************ | |
Last 15 lines from /Users/user/Library/Logs/Homebrew/ngx_openresty/01.configure: |