This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def revenue | |
webhook_notification = Braintree::WebhookNotification.parse(params[:bt_signature], params[:bt_payload]) | |
subscription_id = webhook_notification.subscription.id | |
project = Project.where(:subscription_key => subscription_id).first | |
PM.revenue({:email => project.user.email, | |
:amount_in_cents => project.plan.price * 100}) | |
head :ok | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
public class JavaExample { | |
public static void main(String[] args) throws Exception{ | |
String document = "<html><body>This is a DocRaptor Example</body></html>"; | |
String apikey = "YOUR_API_KEY_HERE"; | |
String encoded_document = URLEncoder.encode(document, "UTF8"); | |
String data = "doc[document_content]=" +encoded_document; | |
data += "&doc[name]=java_sample.pdf"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
public class JavaExample { | |
public static void main(String[] args) throws Exception{ | |
String document = "<html><body>This is a DocRaptor Example</body></html>"; | |
String apikey = "YOUR_API_KEY_HERE"; | |
String data = "doc[document_content]=" + document; | |
data += "&doc[name]=java_sample.pdf"; | |
data += "&doc[document_type]=pdf"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :init do | |
log "Connecting to Database..." | |
do_database_things | |
Rake::Task['data:prep'].enhance do | |
do_post-prep_things | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mongo::Collection | |
def timeout_find(*args) | |
return old_find(*args) unless @catch_timeouts | |
begin | |
old_find *args | |
rescue Mongo::OperationTimeout | |
I.increment "sm.op_timeouts" | |
return [].each | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRIMARY> Array.unique([ObjectId("4f89a3daf5a37c6273000656"),ObjectId("4f89a3daf5a37c6273000656")]) | |
[ | |
ObjectId("4f89a3daf5a37c6273000656"), | |
ObjectId("4f89a3daf5a37c6273000656") | |
] | |
PRIMARY> Array.unique([ObjectId("4f89a3daf5a37c6273000656").toString(),ObjectId("4f89a3daf5a37c6273000656").toString()]) | |
[ "4f89a3daf5a37c6273000656" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wrap(all_with_tag('ReleaseDate') do |x| | |
if x.values.first.nil? | |
nil | |
else | |
x[x.keys.first] = Time.parse(x.values.first) | |
x | |
end | |
end | | |
(allowed_dates.nil? ? nil : select{ |x| allowed_dates.cover? x.values.first}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
topriddy: _ollie: UncheckedExceptions are not good. For example, in storing a user, i search for the username if already used, now MongoDB Java driver throws on this search, worse still it doesnt force my method from catching it | |
[2:17pm] nofxxxx left the chat room. (Ping timeout: 256 seconds) | |
[2:18pm] _ollie: pretty much everyone in the java world agrees that checked exceptions were a mistake from the beginning… have you ever wondered why no other mainstream language has them? | |
[2:18pm] mediocretes: unchecked exceptions aren't enterprise ready | |
[2:18pm] _ollie: says who? | |
[2:18pm] topriddy: mediocretes: +1 | |
[2:19pm] _ollie: good that the spring framework is pretty much the defactor standard for enterprise applications and heavily features unchecked exceptions… | |
[2:19pm] mediocretes: woosh | |
[2:19pm] topriddy: _ollie: well i dont like seeing exceptions for that use case, i even quarelled with the daolayer designer in my team cos he refused to remove the output from logs | |
[2:19pm] marthinal left the chat room. (Remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
josefrichter: guys, getting this error when trying to start mongodb on mac exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating | |
[9:17pm] nodokodo joined the chat room. | |
[9:18pm] josefrichter: any hints please? I'm not good at low level stuff | |
[9:18pm] mediocretes: well, does the dbpath (/data/db) exist? | |
[9:19pm] ascarter left the chat room. (Quit: Computer has gone to sleep.) | |
[9:19pm] linsys: yes do this mkdir -p /data/db | |
[9:19pm] linsys: chown -R mongodb:mongodb /data/db | |
[9:19pm] linsys: or chown -R mongod:mongod /data/db | |
[9:19pm] mediocretes: or put it somewhere else, if you're not comfortable with that | |
[9:20pm] nofxx left the chat room. (Read error: Connection reset by peer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
claudius = { | |
:name => 'Claudius', | |
:bluff => 5, | |
:diplomacy => 7, | |
:intimidate => 3, | |
:perception => 1, | |
:sense_motive => 2, | |
:stealth => 7 } | |
albert = { |