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
| Rails to connect SQL SERVER is a more complicated matter. Since different platforms are different methods of treatment. | |
| Take linux for a different release version has a different treatment methods. | |
| Record ubuntu here under the rails to connect sqlserver steps. | |
| Reference: http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux | |
| 1 Edit ~ /. Bashrc file, add: | |
| export ODBCINI=/etc/odbc.ini |
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
| <?PHP | |
| // Generates a strong password of N length containing at least one lower case letter, | |
| // one uppercase letter, one digit, and one special character. The remaining characters | |
| // in the password are chosen at random from those four sets. | |
| // | |
| // The available characters in each set are user friendly - there are no ambiguous | |
| // characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option, | |
| // makes it much easier for users to manually type or speak their passwords. | |
| // | |
| // Note: the $add_dashes option will increase the length of the password by |
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
| [unix_http_server] | |
| file=/tmp/supervisor.sock ; path to your socket file | |
| [supervisord] | |
| logfile=/var/log/supervisord/supervisord.log ; supervisord log file | |
| logfile_maxbytes=50MB ; maximum size of logfile before rotation | |
| logfile_backups=10 ; number of backed up logfiles | |
| loglevel=error ; info, debug, warn, trace | |
| pidfile=/var/run/supervisord.pid ; pidfile location | |
| nodaemon=false ; run supervisord as a daemon |
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
| # To install the Python client library: | |
| # pip install -U selenium | |
| # Import the Selenium 2 namespace (aka "webdriver") | |
| from selenium import webdriver | |
| # iPhone | |
| driver = webdriver.Remote(browser_name="iphone", command_executor='http://172.24.101.36:3001/hub') | |
| # Android |
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
| import time | |
| import socket | |
| def collect_metric(name, value, timestamp): | |
| sock = socket.socket() | |
| sock.connect( ("localhost", 2003) ) | |
| sock.send("%s %d %d\n" % (name, value, timestamp)) | |
| sock.close() | |
| def now(): | |
| return int(time.time()) |
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
| from time import sleep | |
| from tornado.httpserver import HTTPServer | |
| from tornado.ioloop import IOLoop | |
| from tornado.web import Application, asynchronous, RequestHandler | |
| from multiprocessing.pool import ThreadPool | |
| _workers = ThreadPool(10) | |
| def run_background(func, callback, args=(), kwds={}): | |
| def _callback(result): |
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/sh | |
| if [ $# -eq 0 ]; then | |
| echo "Usage: ./generate_api_controller.sh CONTROLLER" | |
| exit 1 | |
| fi | |
| bundle exec rails generate controller "api/v1/$1" --no_helper --no_assets | |
| rm -rf app/views/api |
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
| # Class to be used as a Liquid File System for the `include` tag | |
| class LiquidTemplateSystem | |
| attr_reader :user | |
| def initialize(user) | |
| @user = user | |
| end | |
| # Return a valid liquid template string | |
| def read_template_file(template_path, context) |
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
| = f.association :cities, :collection => State.all, :as => :grouped_select, | |
| :group_method => :cities, :group_label_method => :name |
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
| /* image rotate javascript */ | |
| /* This script and many more are available free online at | |
| The JavaScript Source!! http://javascript.internet.com | |
| Created by: Benoit Asselin | http://www.ab-d.fr */ | |
| function rotate(p_deg) { | |
| if(document.getElementById('canvas')) { | |
| /* | |
| Ok!: Firefox 2, Safari 3, Opera 9.5b2 |
OlderNewer