Skip to content

Instantly share code, notes, and snippets.

View bengolder's full-sized avatar

Ben Golder bengolder

  • Oakland, CA, USA
  • 19:43 (UTC -07:00)
View GitHub Profile
<settings>
<servers>
<server>
<id>ossrh</id>
<username>bengolder</username>
<password>my-JIRA-user-account-passphrase</password>
</server>
</servers>
<profiles>
<profile>
@bengolder
bengolder / pom.xml
Created September 17, 2016 04:20
The configuration for maven gpg plugin in a pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
@bengolder
bengolder / log.txt
Created September 17, 2016 04:09
Attempt to deploy OpenPDF using `mvn clean deploy`
[INFO] Installing /Users/bengolder/projects/OpenPDF/pdf-rtf/target/pdf-rtf-1.0-sources.jar.asc to /Users/bengolder/.m2/repository/com/github/bengolder/pdf-rtf/1.0/pdf-rtf-1.0-sources.jar.asc
[INFO]
[INFO] --- nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) @ pdf-rtf ---
[INFO] Performing local staging (local stagingDirectory="/Users/bengolder/projects/OpenPDF/target/nexus-staging/staging")...
[INFO] + Using server credentials "ossrh" from Maven settings.
[INFO] * Connected to Nexus at https://oss.sonatype.org:443/, is version 2.13.0-01 and edition "Professional"
[INFO] * Using staging profile ID "19f3351ed12c66" (matched by Nexus).
[INFO] Installing /Users/bengolder/projects/OpenPDF/pdf-rtf/target/pdf-rtf-1.0.jar to /Users/bengolder/projects/OpenPDF/target/nexus-staging/staging/19f3351ed12c66/com/github/bengolder/pdf-rtf/1.0/pdf-rtf-1.0.jar
[INFO] Installing /Users/bengolder/projects/OpenPDF/pdf-rtf/pom.xml to /Users/bengolder/projects/OpenPDF/target/nexus-staging/staging/19f3351ed12c66/com

Keybase proof

I hereby claim:

  • I am bengolder on github.
  • I am bgolder (https://keybase.io/bgolder) on keybase.
  • I have a public key ASAd2AYIW0d4-UUA7MmyT3GDiDogudIlvdRQ4KSQ7tqYWgo

To claim this, I am signing this object:

from intake.forms.form_base import CombinableForm
from intake.constants import Counties
from intake.forms import fields
class OtherCountyForm(CombinableForm):
"""This is used by Code for America to send applicants
information on clean slate services in other counties or states.
"""
@bengolder
bengolder / bad_result.txt
Last active June 21, 2016 15:44
When I try to send a multiline email message through the Front API, all of the newline characters disappear, and I get a result similar to `bad_result.txt`
These should be separate lines of text.
@bengolder
bengolder / module_deep_in_framework.py
Last active June 13, 2016 15:15
How to test a method in isolation from the rest of the class
class ExampleClass:
def __init__(self):
# assume this takes action that you don't want to include in the unit test
self.something = "data from complicated setup that calls other services"
print("accessing", self.something)
@patch('intake.management.commands.send_unopened_apps_notification.notifications')
@patch('intake.management.commands.send_unopened_apps_notification.models')
@patch('intake.management.commands.send_unopened_apps_notification.settings')
def test_send_unopened_apps_notification(self, settings, models, notifications):
models.FormSubmission.get_unopened_apps.return_value = [
Mock(id=1), Mock(id=2)
]
settings.DEFAULT_NOTIFICATION_EMAIL = "someone@agency.org"
@bengolder
bengolder / itext_unicode.java
Last active April 17, 2021 12:57
examples from people using unicode in itext
// from http://osdir.com/ml/java.lib.itext.general/2006-03/msg00662.html
PdfReader pdf = new PdfReader("C:\\VorlageOnline.pdf");
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream("c:\\out.pdf"));
AcroFields af = stp.getAcroFields();
BaseFont bf = BaseFont.createFont("c:\\windows\\fonts\\l_10646.ttf", BaseFont.IDENTITY_H, true);
af.addSubstitutionFont(bf);
af.setField("field1","This is a Test Müller");
stp.close();
// from http://developers.itextpdf.com/examples/itext-action-second-edition/chapter-8#328-textfieldfonts.java
from django.test import TestCase
from django.contrib import auth
class BaseAuthTestCase(TestCase):
def assertLoggedInAs(self, user):
client_user = auth.get_user(self.client)
self.assertEqual(client_user, user)
assert client_user.is_authenticated()