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
- (void)updateGDP | |
{ | |
last_gdp = gdp; | |
int random = arc4random_uniform(250); | |
float growth = ((float)random / 10000); | |
growth = (arc4random_uniform(2) & 1) ? (1 + growth) : (1 - growth); | |
gdp = (long long)gdp * growth; |
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
$(document).ready -> | |
$("input#project_title").keyup -> | |
code = "" | |
title = $("input#project_title").val() | |
words = title.split(RegExp(" ")) | |
if words.length is 1 | |
code = words[0].substring(0, 3) | |
else | |
i = 0 | |
while i < words.length |
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
<div class="progress" data-total="3" data-complete="2" style="background-color: #ececec"> | |
<div class="progressItem"><span class="whiteLeft"></span> </div> | |
<div class="progressItem"><span class="divider"></span> <span class="greyRight"></span> </div> | |
</div> |
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
function contact_forms_clientside_validation_rule_alter(&$js_rules, $element, $context) { | |
// Let's work past the default message to simplify translation support. | |
if($context['type'] == 'form_validate') { | |
foreach($js_rules as $field => $rule) { | |
if(isset($rule['required']) && $rule['required'] == TRUE) { | |
$js_rules[$field]['messages']['required'] = i18n_string('Sitewide:forms:required', 'Required.'); | |
} | |
} | |
} | |
} |
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
%h1 Edit your activity | |
= simple_form_for(@activity, html: { class: 'form-horizontal edit_activity' }, method: :put, url: activity_path(@activity)) do |f| | |
.control-group.text.required | |
%label.text.required.control-label | |
.controls.text | |
=f.input :category, as: :select, collection: categories | |
.control-group.text.required | |
%label.text.required.control-label | |
.controls.text |
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 method_missing method_name, *args | |
super(method_name, args) unless [:get, :post, :put, :patch, :head, :destroy].include? method_name | |
uri = @@base_uri + args.shift | |
body = nil | |
body = args.shift[:body] if args.first.has_key? :body | |
query = nil | |
query = args.shift |
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
<li class="dropdown"> | |
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Projects<b class="caret"></b></a> | |
<ul class="dropdown-menu"> | |
{{#each project in projects}} | |
<li>{{#linkTo project project}}{{project.name}}{{/linkTo}}</li> | |
{{/each}} | |
</ul> | |
</li> |
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 coupon | |
begin | |
coupon = Recurly::Coupon.find(params[:code]) | |
rescue | |
head 404 | |
return | |
end | |
render json: coupon | |
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
# Controller | |
def publish | |
trip = Trip.find(params[:id]) | |
trip.status = 'published' | |
trip.save! | |
redirect_to account_trips_path, notice: 'Your trip is now live!' | |
end | |
# Routes |
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
Template.project_issues.milestones = function() { | |
milestones = Milestones.find({projectId: Session.get('currentProjectId')}).fetch(); | |
milestones.forEach(function(milestone) { | |
issues = Issues.find({projectId: Session.get('currentProjectId')}).fetch(); | |
milestone.issues = []; | |
milestone.issues.push(issues); | |
}); | |
return milestones; |
OlderNewer