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
Before you start: | |
Try not to read ahead. | |
Do one task at a time. The trick is to learn to work incrementally. | |
Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata | |
String Calculator |
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
a.to_a.map { |x| x.join(" = ") }.join(", ") |
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 'net/telnet' | |
def get_imsi(array_of_msisdns, &block) | |
ema = Net::Telnet::new("Host" => "#{HOST}", | |
"Port" => "#{PORT}", | |
"Timeout" => 10, | |
"Prompt" => /Enter command:/) | |
ema.cmd("LOGIN:#{USERNAME}:#{PASSWORD};") | |
ema.waitfor(/Enter command:/) |
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 'oci8' | |
f = File.open("/home/bblite/ported/portedmsisdn.txt") | |
conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER) | |
conn.autocommit = true | |
f.each_line do |msisdn| | |
#I think you would need to validate the MSISDN against a particular regular expression | |
next unless msisdn.match(/^233\d{9}/) | |
#replace the port with the SDP server port | |
`curl 127.0.0.1:8051/blackberry/smsservice?msisdn=#{msisdn.chomp}&msg=deactivate` #you need to deactivate the msisdn on Broker |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Device Properties Example</title> | |
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
// Wait for Cordova to load | |
// |
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
2.0.0-p247 :002 > m "2","a","b" | |
=> ["2", "a", "b"] | |
2.0.0-p247 :003 > (m "2","a","b").class | |
=> Array | |
2.0.0-p247 :004 > def method_missing m,*args; args.class; end | |
=> nil | |
2.0.0-p247 :005 > m "2","a","b" | |
/Users/bjhaid/.rvm/scripts/irbrc.rb:32:in `initialize': can't convert String to Fixnum (String#to_int gives Class) (TypeError) |
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
import java.util.Scanner; | |
import java.lang.Integer; | |
public class Test { | |
public static void main (String args[]) { | |
Scanner input = new Scanner(System.in); | |
while(true) { | |
Integer myint = readWord(input); | |
if (myint != 100) break; | |
System.out.println("Entered word is: " + myint); | |
} |
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
def send_message(subject,message,sender,to,password) | |
msg = <<END_OF_MESSAGE | |
From: #{sender} | |
To: #{to} | |
MIME-Version: 1.0 | |
Content-type: text/html | |
Subject:#{self.load_config['opco']} #{subject} | |
#{message} |
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
#!/bin/bash | |
if [[ `whoami` != foo ]] | |
then echo "Please login as foo user to run this script.... Thanks!" | |
exit 1 | |
fi | |
echo "" | |
echo "######################################################################################################################" | |
echo " ################Extracting DEPENDENCIES##################" | |
echo "######################################################################################################################" | |
echo "" |
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 class OrdBok { | |
public static void main (String args[]) { | |
new OrdBok().run(); | |
} | |
public void run() { | |
BinNode testnode = new BinNode("Ken"); | |
System.out.println("Tree root node " + testnode.value); | |
testnode.addChild(new BinNode("Kfen")); |