Sign up to create your own snipts, or login.

Public snipts » dukeofgaming's snipts The latest snipts from dukeofgaming.

showing 1-3 of 3 snipts
  • Netbeans Macro Commands
    Taken from http://six.vh.paanjoyhost.cn/?p=288: 
    
    Annotations Cycling [annotations-cycling]
    Beep [beep]
    Collapse All [collapse-all-folds]
    Collapse All Java Code [collapse-all-code-block-folds]
    Collapse All Javadoc [collapse-all-javadoc-folds]
    Collapse Fold [collapse-fold]
    Comment [comment]
    Copy [copy-to-clipboard]
    Cut [cut-to-clipboard]
    Debug Filename and Line Number [abbrev-debug-line]
    Debug Identifier [macro-debug-var]
    Delete Line [remove-line]
    Delete Next Character [delete-next]
    Delete Next Word [remove-word-next]
    Delete Preceding Characters in Line [remove-line-begin]
    Delete Previous Character [delete-previous]
    Delete Previous Word [remove-word-previous]
    Delete Selection [remove-selection]
    Delete Tab [remove-tab]
    Dump View Hierarchy [dump-view-hierarchy]
    Expand Abbreviation [abbrev-expand]
    Expand All [expand-all-folds]
    Expand All Java Code [expand-all-code-block-folds]
    Expand All Javadoc [expand-all-javadoc-folds]
    Expand Fold [expand-fold]
    Extend Selection Back [selection-previous-word]
    Extend Selection Backward [selection-backward]
    Extend Selection Down [selection-down]
    Extend Selection Forward [selection-forward]
    Extend Selection to Beginning of Document [selection-begin]
    Extend Selection to Beginning of Line [selection-line-first-column]
    Extend Selection to Beginning of Text on Line [selection-begin-line]
    Extend Selection to Beginning of Word [selection-begin-word]
    Extend Selection to End of Document [selection-end]
    Extend Selection to End of Line [selection-end-line]
    Extend Selection to End of Word [selection-end-word]
    Extend Selection to First Non-whitespace Char [selection-first-non-white]
    Extend Selection to Last Non-whitespace Char [selection-last-non-white]
    Extend Selection to Matching Brace [selection-match-brace]
    Extend Selection to Next Page [selection-page-down]
    Extend Selection to Next Word [selection-next-word]
    Extend Selection to Previous Page [selection-page-up]
    Extend Selection Up [selection-up]
    Fast Import [fast-import]
    Find [find]
    Find Next Occurrence [find-next]
    Find Previous Occurrence [find-previous]
    Find Selection [find-selection]
    Fix Imports [fix-imports]
    Go to Declaration [goto-declaration]
    Go to First Non-whitespace Char [first-non-white]
    Go to Last Non-whitespace Char [last-non-white]
    Go to Line… [goto]
    Go to Source [goto-source]
    Go to Super Implementation [goto-super-implementation]
    Goto Javadoc [goto-help]
    Hide Code Completion [completion-hide]
    Insert Content [insert-content]
    Insert Current Date and Time [insert-date-time]
    Insert Newline [insert-break]
    Insert Tab [insert-tab]
    Insertion Point Backward [caret-backward]
    Insertion Point Down [caret-down]
    Insertion Point Forward [caret-forward]
    Insertion Point to Beginning of Document [caret-begin]
    Insertion Point to Beginning of Line [caret-line-first-column]
    Insertion Point to Beginning of Text on Line [caret-begin-line]
    Insertion Point to Beginning of Word [caret-begin-word]
    Insertion Point to End of Document [caret-end]
    Insertion Point to End of Line [caret-end-line]
    Insertion Point to End of Word [caret-end-word]
    Insertion Point to Next Word [caret-next-word]
    Insertion Point to Previous Word [caret-previous-word]
    Insertion Point Up [caret-up]
    Jump to Next Edit [jump-list-next]
    Jump to Next Edit Cross Window [jump-list-next-component]
    Jump to Previous Edit [jump-list-prev]
    Jump to Previous Edit Cross Window [jump-list-prev-component]
    macro-duplicate-line-below [macro-duplicate-line-below]
    Match Brace [match-brace]
    Move Insertion Point to Bottom [adjust-caret-bottom]
    Move Insertion Point to Center [adjust-caret-center]
    Move Insertion Point to Top [adjust-caret-top]
    Next Bookmark [bookmark-next]
    Next Matching Word [word-match-next]
    Page Down [page-down]
    Page Up [page-up]
    Paste [paste-from-clipboard]
    Paste Formatted [paste-formated]
    Previous Bookmark [bookmark-previous]
    Previous Matching Word [word-match-prev]
    Redo [redo]
    Reformat Code [format]
    Replace [replace]
    Replace Variable With its Getter [make-getter]
    Replace Variable With its is* Method [make-is]
    Replace Variable With its Setter [make-setter]
    Reset Abbreviation [abbrev-reset]
    Scroll Down [scroll-down]
    Scroll Insertion Point to Bottom [adjust-window-bottom]
    Scroll Insertion Point to Center [adjust-window-center]
    Scroll Insertion Point to Top [adjust-window-top]
    Scroll Up [scroll-up]
    Select All [select-all]
    Select Identifier [select-identifier]
    Select Line [select-line]
    Select Next Element [select-element-next]
    Select Next Parameter [select-next-parameter]
    Select Previous Element [select-element-previous]
    Select Word [select-word]
    Set Read Only [set-read-only]
    Set Writable [set-writable]
    Shift Line Left [shift-line-left]
    Shift Line Right [shift-line-right]
    Show Code Completion [completion-show]
    Show Popup Menu [show-popup-menu]
    Show the JavaDoc Window [javadoc-show-action]
    Simulate Escape Key [escape]
    Split Line [split-line]
    Start Macro Recording [start-macro-recording]
    Start New Line [start-new-line]
    Stop Macro Recording [stop-macro-recording]
    Switch Capitalization of Identifier [toggle-case-identifier-begin]
    Switch Case [switch-case]
    To Lowercase [to-lower-case]
    To Uppercase [to-upper-case]
    Toggle Bookmark [bookmark-toggle]
    Toggle Highlight Search [toggle-highlight-search]
    Toggle Line Numbers [toggle-line-numbers]
    Toggle Toolbar [toggle-toolbar]
    Toggle Typing Mode [toggle-typing-mode]
    Uncomment [uncomment]
    Undo [undo]
    

    copy | embed

    0 comments - tagged in  posted by dukeofgaming on Mar 03, 2010 at 8:59 p.m. EST
  • AJAX in Joomla 1.5
    <?php
    	/*
    	/com_mycomponent
    	|-/views
    	|  |-/response
    	|     |-/tmpl
    	|     |  |-default.php
    	|     |  |-index.html
    	|     |-view.raw.php
    	*/
    ?>
    
    <?php
    	//default.php
    	defined('_JEXEC') or die('Restricted access');
    	echo $this->response;
    ?>
    
    <?php
    	//view.raw.php
    	defined('_JEXEC') or die('Restricted access');
    
    	jimport( 'joomla.application.component.view');
    
    	class MycomponentViewResponse extends JView{
    		public function plain($tpl=null){
    			$this->setLayout('default');
    			parent::display($tpl);
    		}
    		public function json($tpl=null){
    			$this->response = json_encode($this->response);
    			$this->setLayout('default');
    			parent::display($tpl);
    		}
    	}
    ?>
    
    
    <?php
    	//somewhere in a controller
    	public function check(){
    		$view = &$this->getView('response','raw');
    		$view->response = 'OK';
    		$view->plain();
    	}
    ?>
    
    In your ajax call use the following base URL:
    
    index.php?option=com_mycomponent&format=raw&
    
    Then append the right controller & task parameters to the url, like:
    
    index.php?option=com_mycomponent&format=raw&controller=mycontroller&task=check
    

    copy | embed

    0 comments - tagged in  posted by dukeofgaming on Jan 18, 2010 at 5:07 p.m. EST
  • Register autoload of classes in a folder with customizable file naming rule
    <?php
    /**
     * @author dukeofgaming
     * @param string $path The path where the files with the classes are located (1 class per file always)
     * @param function $rule Callback that receives the file name as parameter and returns the class name
     */
    function autoloadPath($path,$rule=null){
    	$absolute_path = dirname(__FILE__).DS.$path;
    	$files = array_filter(
    		scandir($absolute_path),
    		create_function('$filename','return preg_match(\'/\.php$/\', $filename);')
    	);
    
    	$classes = array();
    	if($rule === null){
    
    		function class_name($filename){
    			if(preg_match('/(.*)\.php$/', $filename, $matches)){
    				return $matches[1];
    			}
    		}
    
    		foreach($files as $file){
    			$classes[class_name($file)] = $absolute_path.DS.$file;
    		}
    
    	}else{
    		foreach($files as $file){
    			$classes[$rule($file)] = $absolute_path.DS.$file;
    		}
    	}
    
    	spl_autoload_register(
    		create_function('$class','
    			$classes = '.var_export($classes,true).';
    			if(array_key_exists($class, $classes)){
    				require_once($classes[$class]);
    			}
    		')
    	);
    }
    

    copy | embed

    0 comments - tagged in  posted by dukeofgaming on Jan 17, 2010 at 4:21 a.m. EST
Sign up to create your own snipts, or login.