Skip to content

Instantly share code, notes, and snippets.

Dane Jensen careo

Block or report user

Report or block careo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@careo
careo / configuration.rb
Last active Aug 29, 2015
errbit config
View configuration.rb
class Configuration < Attributor::Model
attribute :host, String
attribute :protocol, String
attribute :port, String
attribute :enforce_ssl, String
attribute :confirm_err_actions, String
attribute :user_has_username, String
attribute :use_gravatar, String
@careo
careo / application.md
Last active Aug 29, 2015
Preliminary Praxis Plugin Documentation
View application.md

Uncaught Exceptions

Handling of uncaught exceptions is done by the error handler registered with Appication#error_handler. All applications are pre-configured to use a simple handler that wraps any exception in an InternalServerError response.

This behavior may be customized by registering an error handler with the application like this:

Praxis::Application.configure do |application|
  application.error_handler = MyErrorHandler.new
end
@careo
careo / freezing.rb
Last active Aug 29, 2015
freezing strings
View freezing.rb
RUBY_DESCRIPTION # => "ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]"
"one".freeze.object_id # => 70098950078640
one = "one"
two = "one"
one.object_id # => 70098950065800
two.object_id # => 70098950065780
View README.md
@careo
careo / locals.rb
Last active Jan 3, 2016
thread-fiber-locals
View locals.rb
RUBY_DESCRIPTION
# => "ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]"
Thread.current[:some_local] # => nil
Thread.current[:some_local] = 'main' # => "main"
Thread.current[:some_local] # => "main"
f1 = Fiber.new do
Thread.current[:some_local] # => nil
Thread.current[:some_local] = 'f1' # => "f1"
View MechJebVesselStateUpdated.cs
[KSPEvent(guiActive=false, active=true)]
public void MechJebVesselStateUpdated()
{
// Debug.Log("MechJebVesselStateUpdated");
BaseEventData ed = new BaseEventData(BaseEventData.Sender.USER);
// vessel.torqueRAvailable = vessel.torqueRAvailable + vessel.mass * 20
// vessel.torquePYAvailable = vessel.torquePYAvailable + vessel.mass * 20
View First Solution.c
int main() {
int dollars, cents;
float paid = 4.00f;
float price = 3.10f;
int paidInt = paid * 100;
int priceInt = price * 100;
int changeInt = paidInt - priceInt;
View error
[info] Running CassandraTests
starting...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at scromium.reflect.Reflect$.New(Reflect.scala:23)
at scromium.Cassandra$.createConnectionPool(Cassandra.scala:77)
at scromium.Cassandra$.start(Cassandra.scala:27)
View bench-erb.rb
require 'benchmark'
require 'erb'
require 'rubygems'
require 'erubis'
# generate templates
LINES = 1_000
perline = ""
View schema-something.rb
require 'rubygems'
require 'cassandra/0.7'
cassandra = Cassandra.new "system"
keyspaces = cassandra.send(:client).describe_keyspaces
keyspace_name = "SomeTest"
cf_name = "Tests"
You can’t perform that action at this time.