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
class RubyClassInstanceVariableTest | |
def self.attr1 | |
@attr1 = "*att1*" | |
end | |
def self.test1 | |
attr1 | |
puts "Try directly print @attr1: #{@attr1}" | |
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
ImageMagick useage: | |
convert goblin.png -crop 64x64 -background transparent player.png |
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
sudo ifconfig eth0 192.168.11.187 netmask 255.255.0.0 | |
sudo route add default gw 192.168.8.5 | |
add nameserver 192.168.8.5 to file /etc/resolv.conf | |
cd /media/xubuntu/WD2TB | |
sudo dd if=/dev/sda of=T420HDD-20150506.img |
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
# at bottom of environment.rb | |
ActionMailer::Base.delivery_method = :smtp | |
ActionMailer::Base.default_content_type = "text/html" | |
ActionMailer::Base.smtp_settings = { | |
:address => "smtp.126.com", | |
:port => 25, | |
:domain => "www.zhaoonline.com.com", | |
:authentication => :login, | |
:user_name => "boy.365@126.com", | |
:password => "xxxxxxxx", |
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
#!/bin/sh | |
case "$1" in | |
start) | |
/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1 | |
;; | |
stop) | |
killall lighttpd | |
;; | |
restart) |
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
# in app/models/ | |
class NoisyImage | |
require 'RMagick' | |
include Magick | |
attr_reader :code, :code_image | |
def initialize(length = 4) | |
text_size = 20 | |
validbglinecolors = ['#FFF', '#FFF', '#FFF', '#FFF', '#FFF'] |
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
# 关于oracle plsql developer | |
imp file=xxx fromuser=xxx touser=xxx | |
sqlplus "/as sysdba" | |
startup |
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
<?PHP | |
// First off, how many items per page? | |
$per_page = 4; | |
// Next, get the total number of items in the database | |
$num_videos = $db->getValue("SELECT COUNT(*) FROM videos where status = 'approved' ORDER BY dt"); | |
// Initialize the Pager object | |
$pager = new Pager($_GET['p'], $per_page, $num_videos); | |
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
--搜索关键字的记录 | |
CREATE OR REPLACE PROCEDURE P_NEWKEYWORD( | |
p_keyword VARCHAR | |
)IS | |
v_keyword_id number; | |
v_now date:=sysdate; | |
BEGIN | |
BEGIN | |
SELECT ID INTO v_keyword_id FROM KEYWORDS WHERE keyword=p_keyword AND ROWNUM=1; |
OlderNewer