Skip to content

Instantly share code, notes, and snippets.

@aglassman
aglassman / pythonchallenge_1.py
Last active December 24, 2015 03:09
Python Challenge #1: My polished soluiton.
#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 September 27, 2013 22:09
Python Challenge #0: My uber complicated solution to challenge 0.
pow(2,38)
@aglassman
aglassman / pythonchallenge_1-2.py
Created October 3, 2013 18:48
Python Challenge #1: A not as cool way.
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 October 7, 2013 18:05
This class will run a few simple tests using the new Java 8 features 'lambda expressions' and 'Streams'.
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 December 29, 2015 08:29
Some Google Apps Script for logging finances in a Google Spreadsheet.
/**
* 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();
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;
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;
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);
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
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