Skip to content

Instantly share code, notes, and snippets.

@mkristian
mkristian / google.rb
Last active December 13, 2015 22:18
getting up and running with OAuth using https://github.com/google/signet
require 'signet/oauth_1/client'
client = Signet::OAuth1::Client.new(
:temporary_credential_uri =>
'https://www.google.com/accounts/OAuthGetRequestToken',
:authorization_uri =>
'https://www.google.com/accounts/OAuthAuthorizeToken',
:token_credential_uri =>
'https://www.google.com/accounts/OAuthGetAccessToken',
:client_credential_key => 'anonymous',
:client_credential_secret => 'anonymous'
@mkristian
mkristian / $ mvn dependency:tree
Last active December 12, 2015 06:28
minimal with gem dependency to compass-0.12.2
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gems 0.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ gems ---
[INFO] com.example:gems:jar:0.0.0
[INFO] \- rubygems:compass:gem:0.12.2:compile
require 'net/http'
require 'net/https'
require 'uri'
uri = URI.parse('https://www.google.com/index.html')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == "https" # enable SSL/TLS
http.start {
http.request_get(uri.path) {|res|
print res.body
@mkristian
mkristian / gist:3719869
Created September 14, 2012 04:52
diff between classes from jruby-core and jruby-complete
--- jruby-core/list.txt2 2012-09-14 09:47:13.995341951 +0530
+++ jruby-complete/list.txt2 2012-09-14 09:36:38.307311185 +0530
@@ -53,121 +53,15 @@
./com/kenai/constantine/Constant.class
./com/kenai/constantine/ConstantSet.class
+./com/kenai/constantine/ConstantSet$ConstantImpl.class
./com/kenai/constantine/ConstantSet$ConstantIterator.class
./com/kenai/constantine/platform
-./com/kenai/constantine/Platform$1.class
-./com/kenai/constantine/Platform$2.class
@mkristian
mkristian / gist:3611387
Created September 3, 2012 17:55
failing nexus plugin IT
com.google.inject.CreationException: Guice creation errors:
1) null returned by binding at org.sonatype.guice.bean.binders.LocatorWiring
but parameter 0 of org.sonatype.security.model.source.FileModelConfigurationSource.<init>() is not @Nullable
while locating java.io.File annotated with @com.google.inject.name.Named(value=${security-xml-file})
for parameter 0 at org.sonatype.security.model.source.FileModelConfigurationSource.<init>(Unknown Source)
at file:/home/kristian/.m2/repository/org/sonatype/security/security-model-xml/2.8.1/security-model-xml-2.8.1.jar!/
while locating org.sonatype.security.model.source.FileModelConfigurationSource
while locating org.sonatype.security.model.source.SecurityModelConfigurationSource annotated with @com.google.inject.name.Named(value=file)
for parameter 3 at org.sonatype.security.realms.tools.DefaultConfigurationManager.<init>(Unknown Source)
at file:/home/kristian/.m2/repository/org/sonatype/security/realms/security-xml-realm/2.8.1/security-xml-realm-2
@mkristian
mkristian / Mavenfile
Created June 19, 2012 07:19
jruby-rack-1.1.x can not handle PUT request
jar 'org.jruby.rack:jruby-rack', '1.0.10'
@mkristian
mkristian / pom-compass.xml
Last active August 2, 2016 14:28
using gem-maven-plugin to compass compile or execute sass. sass with gem dependency within plugin and compass with global compile dependency (which is also added to the java-classpath and not so nice)
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>0.0.36</version>
@mkristian
mkristian / Gemfile
Created October 17, 2011 12:58
running dm-core specs with dm-hibernate-adapter
require 'pathname'
source 'http://rubygems.org'
SOURCE = ENV.fetch('SOURCE', :git).to_sym
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
DM_VERSION = '~> 1.1.0'
DO_VERSION = '~> 0.10.2'
DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
public class MyEntryPoint implements EntryPoint {
public static class Pizza {
public String crust;
public int quantity;
public int size;
public List<String> toppings = new ArrayList<String>();
}
public static class PizzaOrder {
public String phone_number;
project 'Sitebricks :: Core' do
id 'com.google.sitebricks:sitebricks:0.8.6-SNAPSHOT'
inherit 'com.google.sitebricks:sitebricks-parent:0.8.6-SNAPSHOT'
packaging 'jar'
jar 'org.testng:testng:${org.testng.version}':jdk15 do
scope :test
end
jar 'com.google.sitebricks:sitebricks-converter'