JavaScript TinyMCE默认配置

<script language="javascript" type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
	<script language="javascript" type="text/javascript">
		tinyMCE.init({
			mode : "textareas",
			theme : "advanced",
			theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_path_location : "bottom",
			extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
		});
	</script>

XML svnserve plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>us.davec.svnserve</string>
        <key>ProgramArguments</key>
        <array>
                <string>/opt/local/bin/svnserve</string>
                <string>-d</string>
                <string>-r</string>
                <string>/svn</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>root</string>
</dict>
</plist>

JavaScript 删除所有childNodes

var holder = document.getElementById("whateverDiv");//the holder div
	
while(holder.hasChildNodes()){
	holder.removeChild(holder.lastChild);
}

Bash 已安装列表/搜索包

dpkg -l
# you can alternatively search for packages using the following
dpkg -l | grep [enter_search_term_here]
# or if you like shortcuts, here is one that you can put in ~/.bashrc or ~/.bash_profile
# instead type in dpkg ... you can use : find_package "name_of_package"
find_package () { dpkg -l | grep "$1"; }

PHP 连接,检索,插入,断开类

<?php
//created by me...

class apple {
    // connect to, and select the database
    private function connectDB(){
    $dbconnect = mysql_connect('localhost', 'root','', 'form')
    or die('no connection');
    mysql_select_db("form");
    echo 'connected';
    }

    // get table names
    function gettables(){
        $this->connectDB();
        $query = 'SHOW TABLES from form';
        $result = mysql_query($query);
        $num_rows = mysql_num_rows($result);
        for ($i = 0; $i < $num_rows; $i++) {
           echo "<p>Table: ", mysql_tablename($result, $i), "</p>\n";
    }
}

    // list articles
    function goober() {
        $this->connectDB();
        $result = mysql_query("SELECT * FROM article");
        while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
            print("<h2>".$row['title']."</h2>");
            print($row["content"]."<br />");
          }
    }

    // insert article
    function insertArticle(){
        $sql = mysql_query("INSERT INTO article (title, content) VALUES('class1', 'tree1')")
        or die;
    }

    // disconnect
    function disconnectDB(){
        mysql_close();
    }
}

$art= new apple(); // instantiate the class
$art->goober(); //retrieves articles and displays them
//$art->insertArticle();
$art->disconnectDB();

?>

JavaScript Javascript - Eliminar标签A en paginadeimpresión

<html>
<head>
<title>MySite</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function volcarContenido(){
	contenido = opener.document.getElementById('impresion').innerHTML;
	contenido = contenido.replace(/<a([^>]+)>|<\/a>/gi,"")
	document.write(contenido);
}
</script>
</head>
<body >
<script>volcarContenido()</script>
</body>
</html>

Bash 字符到十六进制

# grab a character and print it as hexidecimal
printf("0x%d", argv[1][0])

JavaScript 添加元素

function addElement() {
          var ni = document.getElementById('');
          var divIdName = '';
          
          var newdiv = document.createElement('div');
          
          newdiv.setAttribute('id',divIdName);
          newdiv.innerHTML = '';
          
          ni.appendChild(newdiv);
        }

XML 插入图片

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>name</key>
        <string>Insert Image</string>
        <key>uuid</key>
        <string>B1EB3F7A-2989-4E32-A892-83013991F175</string>
        <key>input</key>
        <string>none</string>
        <key>output</key>
        <string>afterSelectedText</string>
        <key>command</key>
        <string>#!/usr/bin/env ruby

abort unless ENV['TM_PROJECT_DIRECTORY'] && ENV['TM_FILEPATH']

SUPPORT = ENV['TM_SUPPORT_PATH']
DIALOG  = SUPPORT + '/bin/CocoaDialog.exe'

require 'pathname'
require 'find'

images = []
menu   = []

# Find all images within a project and stuff them into
# an array (images) of hashes.
Find.find(ENV['TM_PROJECT_DIRECTORY']) do |f|
  file_name = File.basename(f)
  if /\.(gif|jpg|png)$/ =~ file_name
  	images << {
  		:title => file_name,
  		:path  => Pathname.new(f).relative_path_from(Pathname.new(ENV['TM_FILEPATH']).parent).to_s 
  	}
  end
end
abort if images.empty?

images = images.sort_by { |image| image[:title] }

# If there are less than 10 images within a project, use
# a popup menu; otherwise, use a dropdown.
if images.length < 10 then
  images.each_with_index do |image, i|
    menu << %("&#{i+1}  #{image[:title]}" )
  end
  selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1
else
  images.each do |image|
    menu << %("#{image[:title]}" )
  end
  text = %{--text "Choose an image"}
  button1 = %{--button1 "Cancel"}
  button2 = %{--button2 "Select Image"}
  result = `\"#{DIALOG}\" dropdown #{button2} #{button1} #{text} --items #{menu}`.split("\n")
  abort if result[0].to_i == 1
  selected = result[1].to_i
end

print %{url(#{images[selected][:path]})}
</string>
        <key>keyEquivalent</key>
        <string>@I</string>
        <key>scope</key>
        <string>source.css</string>
        <key>beforeRunningCommand</key>
        <string>saveActiveFile</string>
    </dict>
</plist>

Objective C 单击窗口时如何防止应用程序变为活动状态?

- (BOOL)canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow;
- (BOOL)acceptsFirstResponder;

of NSView:


- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent;

and the style mask during the initialization:


styleMask:(� your app specific other flags� | NSNonactivatingPanelMask)