Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Glassman aglassman

View GitHub Profile
@aglassman
aglassman / pythonchallenge_1.py
Last active Dec 24, 2015
Python Challenge #1: My polished soluiton.
View pythonchallenge_1.py
#testing revision 2
import string
l = string.lowercase
trans = string.maketrans(string.letters,l[2:]+l[:2])
string.translate(input,trans)
@aglassman
aglassman / pythonchallenge_0.py
Created Sep 27, 2013
Python Challenge #0: My uber complicated solution to challenge 0.
@aglassman
aglassman / pythonchallenge_1-2.py
Created Oct 3, 2013
Python Challenge #1: A not as cool way.
View pythonchallenge_1-2.py
s="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
o=""
for x in s:
if ord(x)>=ord('a') and ord(x)<=ord('z'):
o+=chr((ord(x)+2-ord('a'))%26+ord('a'))
else:
o+=x
print o
@aglassman
aglassman / JavaEightTests.java
Created Oct 7, 2013
This class will run a few simple tests using the new Java 8 features 'lambda expressions' and 'Streams'.
View JavaEightTests.java
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.stream.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
public class JavaEightTests
{
@aglassman
aglassman / logFinancialHistory.js
Last active Dec 29, 2015
Some Google Apps Script for logging finances in a Google Spreadsheet.
View logFinancialHistory.js
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
View GreedyHealingSolution.java
package com.gmjm.challenge1.solutions.gitter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gmjm.challenge1.Challenge.Node;
import com.gmjm.challenge1.ChallengeSolution;
View DemoNeo4jConfig.java
package org.gmjm;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
View SpringDataNeo4jDemoApplication.java
package org.gmjm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDataNeo4jDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDataNeo4jDemoApplication.class, args);
View build.gradle
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
View stacktrace.txt
rg.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not instantiate value of type [simple type, class org.gmjm.logistics.domain.Hub] from String value ('http://localhost:8080/hubs/1044'); no single-String constructor/factory method
at [Source: HttpInputOverHTTP@207155db; line: 2, column: 30] (through reference chain: org.gmjm.logistics.domain.Route["originHub"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class org.gmjm.logistics.domain.Hub] from String value ('http://localhost:8080/hubs/1044'); no single-String constructor/factory method
at [Source: HttpInputOverHTTP@207155db; line: 2, column: 30] (through reference chain: org.gmjm.logistics.domain.Route["originHub"])
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:224) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.http.conver
You can’t perform that action at this time.