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
| let url = NSURL(string: "http://www.telize.com/geoip") | |
| let urlRequest = NSURLRequest(URL: url) | |
| let session = NSURLSession.sharedSession() | |
| let task = session.dataTaskWithURL(url, | |
| completionHandler: {data, response, error -> Void in | |
| if error != nil { | |
| println("error") | |
| } else { |
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
| let url = NSURL(string: "http://www.haskell.org/happy/Happy.gif") | |
| let urlRequest = NSURLRequest(URL: url) | |
| NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue(), | |
| completionHandler: { | |
| response, data, error in | |
| if error != nil { | |
| println("There was an error") | |
| } else { |
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
| let url = NSURL(string: "http://www.haskell.org/happy/Happy.gif") | |
| let urlRequest = NSURLRequest(URL: url) | |
| NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue(), | |
| completionHandler: { | |
| response, data, error in | |
| if error != nil { | |
| println("There was an error") | |
| } else { |
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>Hello</title> | |
| </head> | |
| <body ng-app="HelloWorldApp" > | |
| <div ng-controller="HelloController" class="container" > | |
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
| @Test | |
| public void testValidateSomeEventId() { | |
| // setup: | |
| // mock request | |
| MockRequestContext requestContext = new MockRequestContext(); | |
| // mock message context: | |
| MessageContext messages = requestContext.getMessageContext(); | |
| messages.clearMessages(); |
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
| from suds.client import Client | |
| url="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" | |
| client = Client(url) | |
| print client ## shows the details of this service | |
| result = client.service.GetWeatherInformation() | |
| print result ## see: restult.txt below |
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
| @Test | |
| public void testValidateInitialDetailsCapture() { | |
| MyModel myModel = new MyModel(); | |
| // setup: | |
| MyModel.setSomeField("Some Value"); | |
| // this is the line that stumped me | |
| ValidationContext validationContext = new DefaultValidationContext(requestContext, null, null); |
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
| - name: print to stdout | |
| command: echo "hello" | |
| register: hello | |
| - debug: msg="{{ hello.stdout }}" | |
| - debug: msg="{{ hello.stderr }}" |
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
| from django.contrib.sites.models import Site | |
| import uuid | |
| def upload_to(instance, filename): | |
| current_site = Site.objects.get_current() | |
| extension = filename.split(".")[-1] | |
| instance_slug = getattr(instance,"slug",False) | |
| if not instance_slug: |
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 requests | |
| url = "http://bulksms.2way.co.za:5567/eapi/submission/send_sms/2/2.0" | |
| phone_number = 27123456678 | |
| data = {'username' : 'xxxx', 'password' : 'xxxx', 'message' : 'Testing SMS', 'msisdn' : phone_number} | |
| response = requests.post(url,data) |