Skip to content

Instantly share code, notes, and snippets.

View stevez's full-sized avatar

Steve Zhang stevez

  • Scotiabank
  • Markham, Ontario, Canada
View GitHub Profile
main
adfadfasdf
asdfa
sdfas
df
asd
f
<wtkbuild
destdir="${outputclasses}"
encoding="${src.encoding}"
source="1.3" srcdir="${src.dir}:${rim.src.dir}"
preverify="false">
<classpath location="${rimlib.loc}"/>
</wtkbuild>
def reverse_string(s)
s.reverse().scan(/[\w]+/).collect { |w| w.reverse()}
end
r = reverse_string("The quick brown fox jumped over the lazy dog")
puts r
class SudokuSolver
def initialize(puzzle)
@@p = puzzle.split(//)
end
#Algorithm to solve the sudoku puzzle
def solver
#81 times for each block in the puzzle
@stevez
stevez / blackberry-pre-debug
Created September 7, 2011 02:05
blackberry-pre-debug target
<target name="blackberry-pre-debug" depends="blackberry-load-setings" if="blackberry.trigger">
<copy todir="${platform.home}/simulator">
<fileset dir="${dist.dir}" includes="${name}.*"/>
<fileset dir="${dist.dir}" includes="*.debug"/>
</copy>
<condition property="jpda.port" value="${JDWPPort}" else="8000">
<isset property="JDWPPort"/>
</condition>
</target>
<target name="clean-blackberry" if="blackberry.trigger">
<delete file="${dist.dir}/${name}.cod" failonerror="false"/>
<delete file="${dist.dir}/${name}.cso" failonerror="false"/>
<delete file="${dist.dir}/${name}*.debug" failonerror="false"/>
<delete failonerror="false">
<fileset dir="${platform.home}/simulator">
<include name="**/${name}*.*"/>
</fileset>
</delete>
</target>
<target name="create-cod" if="blackberry.trigger">
<exec dir="${dist.dir}" executable="java" failonerror="true">
<arg value="-cp"/>
<arg value="${platform.home}/bin/rapc.jar"/>
<arg value="net.rim.tools.compiler.Compiler"/>
<arg value="import=${platform.bootclasspath}"/>
<arg value="codename=${name}"/>
<arg value="-cldc"/>
<arg value="jad=${basedir}/${dist.dir}/${dist.jad}"/>
<arg value="${basedir}/${dist.dir}/${dist.jar}"/>
var F = function() {};
F.prototype.a = 'b';
F.prototype.a; // b
var s = new F(); // s get the F.prototype
s.a; // return 'b';
s.prototype; // return undefined
var string = new String(); //get String.property
var array = new Array(); //get Array.property
var num = new Number(); // get Number.property
var F = function() {};
F.prototype.a = 'b';
var s = new F();
print(s.a);
print(s.hasOwnProperty('a')); //false
s.a = 'c'; // object s will create its new property 'a'
print(s.a); // c
print(s.hasOwnProperty('a')); // true;