This file contains 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 rocket import Rocket | |
from bottle import Bottle | |
from bottle import route | |
app = Bottle(__name__) | |
app.debug = True | |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
/* | |
* Assume the following: | |
* | |
* - The Plist file is called: Names.plist | |
* - @property NSArray *tableData | |
* - Callback block messages UITableView with reloadData | |
*/ | |
- (void)initizeDataWithTableViewCallback:(void(^)(void))reloadDataMessage | |
{ |
This file contains 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
/* | |
* Assume the following: | |
* | |
* @property UILocalizedIndexCollation *collation; | |
* @property NSMutableArray *sections; | |
* @property NSArray *tableData; | |
*/ | |
- (void)configureSectionData | |
{ |
This file contains 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 collections import namedtuple | |
# Assume a previously executed query. | |
rows = cursor.fetchall() | |
# Index 0 of the metadata returned is the column name. | |
columns = [aColumn[0] for aColumn in cursor.description] | |
NamedRow = namedtuple('NamedRow', columns) | |
# A generator may help with larger datasets. |
This file contains 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
# http://www.jython.org/archive/21/docs/subclassing.html | |
import java.lang | |
import java.util | |
class SafeStack(java.util.Stack): | |
""" | |
http://docs.oracle.com/javase/7/docs/api/java/util/Stack.html |
This file contains 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 splitStringWithBadlyFormedCSV(aString): | |
""" | |
Return list of fields in aString, splitting by commas while ignoring | |
commas that appear within double-quoted strings. | |
""" | |
ignore = False | |
splices = list() | |
anchor = 0 | |
for cursor in range(len(aString)): | |
character = aString[cursor] |
This file contains 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
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.mariodiana.rest</groupId> | |
<artifactId>RESTfulExample</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>RESTfulExample Maven Webapp</name> |
This file contains 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.HashSet; | |
import java.util.Set; | |
import javax.ws.rs.ApplicationPath; | |
import javax.ws.rs.core.Application; | |
import javax.ws.rs.core.Context; | |
import javax.servlet.ServletContext; | |
import org.slf4j.Logger; |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
version="3.0"> | |
</web-app> |
OlderNewer