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
    
  
  
    
  | require 'rubygems' | |
| require 'nokogiri' | |
| require 'fileutils' | |
| require 'date' | |
| # usage: ruby import.rb my-blog.xml | |
| # my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
| data = File.read ARGV[0] | |
| doc = Nokogiri::XML(data) | 
  
    
      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
    
  
  
    
  | require 'rubygems' | |
| require 'nokogiri' | |
| require 'fileutils' | |
| require 'date' | |
| require 'yaml' | |
| # usage: ruby import.rb my-blog.xml | |
| # my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
| data = File.read ARGV[0] | 
  
    
      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
    
  
  
    
  | # add these to your .bash_profile | |
| # title sets your terminal tab's title to any string you pass in. | |
| # from http://stackoverflow.com/a/1687708 | |
| function title() { echo -n -e "\033]0;$@\007";} | |
| # cd modifies the cd command and uses title to set it to whatever the current dir is. | |
| # from http://superuser.com/a/296555 | |
| function cd() { builtin cd "$@" && title ${PWD##*/}; } | 
  
    
      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
    
  
  
    
  | please(show).the(square_root).of(100) | |
| ={it}([{println it}]).{clos -> [delegate[0],clos]}(square_root).{delegate[0](delegate[1](it))}(100) | |
| =[{println it}].[delagate[0], square_root].[delegate[0](delegate[1](100))] | |
| = [{println it}, square_root].[delegate[0](delegate[1](100))] | |
| =println(square_root(100)) | |
  
    
      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
    
  
  
    
  | //try1 | |
| println please.class.name | |
| println please.delegate | |
| println show | |
| println show.class.name | |
| println show.delegate | |
| println please(show).delegate | |
| println please(show).the(square_root) | 
  
    
      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
    
  
  
    
  | Object.metaClass.of = { delegate[0](delegate[1](it))} | |
| Object.metaClass.the = { clos -> [delegate[0], clos]} | |
| show = [ {println it} ] | |
| square_root = { Math.sqrt(it) } | |
| please = {it} | |
| please show the square_root of 100 | 
  
    
      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
    
  
  
    
  | public static int maxProd(int[] input){ | |
| int max1 = max2 = max3 = java.lang.Integer.MIN_VALUE; | |
| int min1 = min2 java.lang.Integer.MAX_VALUE; | |
| for(int i=0; i<input.length;i++){ | |
| int val= input[i]; | |
| range calcmax{ | |
| if(val > max1){ | |
| max2 = max1; // dont lose the old max1 | 
  
    
      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
    
  
  
    
  | public static int maxProd(int[] input){ | |
| int max1 = max2 = max3 = java.lang.Integer.MIN_VALUE; | |
| int min1 = min2 java.lang.Integer.MAX_VALUE; | |
| for(int i=0; i<input.length;i++){ | |
| // recalc the new max3 numbers | |
| int val= input[i]; | |
| if(val > max1){ | |
| max2 = max1; // dont lose the old max1 | |
| max1=val; | 
  
    
      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
    
  
  
    
  | // yaml version of the same | |
| - object: function | |
| id: | |
| comment: | |
| fact: 'multiplies(x,y)' | |
| name: multipliesTwo | |
| expr: | |
| - object: expr | |
| id: | |
| comment: | 
  
    
      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
    
  
  
    
  | ometa JackParser { | |
| id = string, | |
| comment = string, | |
| fact = string, | |
| name = string, | |
| operator = name, | |
| arg = name | expr, | |
| header = [id:id comment:comment fact:fact] -> { id:id, comment:comment, fact:fact}, | 
NewerOlder