Skip to content

Instantly share code, notes, and snippets.

View amro's full-sized avatar

Amro Mousa amro

View GitHub Profile
{:order =>
{:id=>193891,
:campaign_id=>"fdajsfd",
:email_id=>"lazar@gmail.com",
:total=>17.44,
:items=>
<html>
<body>
<script type="text/javascript">
var numbers = new Array();
numbers[0] = "1";
numbers[1] = "1";
//In this example all three run
if (...) {
}
if (...) {
}
if (...) {
}
@amro
amro / gist:934904
Created April 21, 2011 16:22
Dynamic UITabelViewCell Height Based on String
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *string = [array objectAtIndex:indexPath.row];
CGSize suggestedSize = [string sizeWithFont:[UIFont systemFontOfSize:15.0]
constrainedToSize:CGSizeMake(224.0, FLT_MAX)
lineBreakMode:UILineBreakModeWordWrap];
return suggestedSize.height + 40; // add 40px for padding
}
var foo = ["blah", "hi", "bar"];
for (int i = 0; i < foo.length(); i++) {
alert(foo[i]);
}
#import "MCTabBarController.h"
@interface MCTabBarController()
- (void)checkAuthStatus;
@end
@implementation MCTabBarController
....
- (void)someMethod {
[self checkAuthStatus];
require 'httparty'
require 'json'
require 'cgi'
require File.join(File.dirname(__FILE__), 'handlers', 'uakari_delivery_handler')
class Uakari
include HTTParty
default_timeout 30
attr_accessor :apikey, :timeout, :options
@amro
amro / batch_sub_test.rb
Created December 9, 2011 16:20
Gibbon List Batch Subscribe Functional Test
require 'gibbon'
batch = []
(1..3000).each do |i|
batch << {:EMAIL => "foo+#{i.to_s}@gmail.com", :EMAIL_TYPE => "html"}
end
g = Gibbon.new("YOUR_APIKEY-DC")
puts "Response: " + g.list_batch_subscribe({:id =>"YOUR_LIST_ID", :double_optin => "false", :batch => batch, :update_existing => true}).to_s
//Start at negative kWiggleAnimationAngle so we animate to positive kWiggleAnimationAngle
view.layer.transform = CATransform3DMakeRotation(-kWiggleAnimationAngle, 0, 0, 1.0);
//Setup a transform that will rotate our view to positive kWiggleAnimationAngle
CATransform3D transform = CATransform3DMakeRotation(kWiggleAnimationAngle, 0, 0, 1.0);
//Setup our animation with the transform
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:transform];
animation.repeatCount = HUGE_VALF;
u = User.find(id)
s = Section.find(section_id)
t = Todo.new do |d|
d.name = "Finish me"
d.due_by = 1.day.ago
end
u.todos << t
s.todos << t