This file contains hidden or 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
//Document Container | |
type JSONContainer struct { | |
data []interface{} | |
} | |
//Return all objects | |
func (j *JSONContainer) All() (objects []JSONObject) { | |
for _, v := range j.data { | |
newJSONObject := JSONObject{data: v} | |
objects = append(objects, newJSONObject) |
This file contains hidden or 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
val, _ := v.Get("payload.deeper_nesting.return_value") |
This file contains hidden or 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
type JSONContainer struct { | |
data []interface{} | |
} | |
func (j *JSONContainer) All() (objects []JSONObject) { | |
for _, v := range j.data { | |
objects = append(objects, JSONObject{data: v}) | |
} | |
return | |
} |
This file contains hidden or 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
func main(){ | |
dyn, err := MakeJSONContainer(rawData) | |
if err != nil { | |
fmt.Println("error:", err) | |
} else { | |
for _, v := range dyn.All() { | |
if val ,err := v.Get("payload.deeper_nesting.return_value");err == nil { | |
println(val) | |
} else { | |
fmt.Println("error:", err) |
This file contains hidden or 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
Turns this: | |
accounts = Account.all() | |
while accounts: | |
for account in accounts: | |
print 'Account: %s' % account | |
try: | |
accounts = accounts.next_page() | |
except PageError: | |
accounts = () |
This file contains hidden or 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
£ == £ |
This file contains hidden or 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
<?php | |
require_once('recurlyphp/lib/recurly.php'); | |
// Required for the API | |
Recurly_Client::$subdomain = 'yoursubdomain' | |
Recurly_Client::$apiKey = 'apikey'; | |
Recurly_js::$privateKey = 'privatekey'; | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'aaa1234588'),'subscription' => array( | |
'plan_code' => 'plan_trial', |
This file contains hidden or 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
<?php | |
require_once('recurlyphp/lib/recurly.php'); | |
// Required for the API | |
//greenlantern | |
Recurly_Client::$apiKey = 'yourapikey'; | |
Recurly_js::$privateKey = 'yourprivatekey'; | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'1'),'transaction' => array('description' => "test trans \n for you",'amount_in_cents'=>'999'))); | |
?> |
This file contains hidden or 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
Recurly.buildSubscriptionForm({ | |
/* other options */ | |
subscription: { | |
couponCode: 'testplan' | |
}, | |
distinguishContactFromBillingInfo: true, | |
afterInject: function(){ | |
$('.submit').text('Join Playa'); | |
$('div.check').click(); | |
}, |
This file contains hidden or 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
Recurly.buildSubscriptionForm({ | |
/* other options */ | |
afterInject: function(){ | |
$('.month select').val(2); //month | |
$('.year select').val(2016); //year | |
}, | |
}); |