Skip to content

Instantly share code, notes, and snippets.

Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 1.3.1
Python Version: 2.6.1
Installed Applications:
['django.contrib.auth',
+ (void)test {
when([RemoteFactory createA:[ArticleTest class] from:@"http://192.168.1.106:1337/api/articles/1.json"], ^{
ArticleTest *article = (ArticleTest *)tab00;
PO([article ashes])
});
}
{"content":"\n \n \n \n \n\t\t\t \n \n \n\tAsta e cea mai CIUDATA sedinta foto de la o nunta! Uite ce lucru excentric au facut acesti tineri casatoriti\n\n \n \n \n \n\tUn cuplu din China a facut schimb de haine pentru sedinta foto a nuntii.\n\n \n\t\u00a0Astfel, mirele a purtat rochia de mireasa in timp ce mireasa s-a imbracat la costum. You Yao si sotul ei, Sun Bin, au facut pozele in aprilie anul trecut si le-au facut publice la aniversare unui an de casnicie. \"Dupa ce am tinut pozele ascunse timp de un an de zile, am vrut sa le impartasim cu prietenii\", a marturisit You Yao. \"Pozele de nunta sunt un lucru pe care il faci o singura data in viata si am vrut ca ale noastre sa fie speciale\", au explicat cei doi din dorinta de a se face intelesi pentru motivul pentru care au facut schimb de imbracaminte.\n\n\tSursa foto: Rexfeatures.com\n \n \n \n \n \n \t\n \n \n \n\n\n\t\t\n\t\t\n\t\t\n\t\t
@problems = MonitorTask.where("date < '#{1.month.ago}'").includes(:problem).collect { |task| task.problem }
@problems.sort! { |x, y|
@count[y.id] ||= @problems.count { |p| p.id == y.id} <=>
@count[x.id] ||= @problems.count { |p| p.id == x.id}
}
def forum_link
doc = Nokogiri::HTML(open(ia_link))
puts "$" * 100
link = doc.css("script").select { |node|
re = %r/topic_id=(?<forum_id>[[:digit:]]+)/
match = re.match(node.content)
if match
match[1]
else
nil
@andrei512
andrei512 / JewelBox.h
Created September 7, 2012 16:46
JewelBox
//
// JewelBox.h
// Clomp
//
// Created by Andrei on 8/12/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@andrei512
andrei512 / facepile.json
Created September 14, 2012 10:56
sample facepile JSON
{
"faces" : ["https://si0.twimg.com/profile_images/1860046271/image_normal.jpg",
"https://si0.twimg.com/profile_images/2518045421/image_normal.jpg",
"https://si0.twimg.com/profile_images/2452768851/bhd68fvfnr5k0micbpcz_normal.jpeg",
"https://si0.twimg.com/profile_images/1824002576/pg-railsconf_normal.jpg",
"https://si0.twimg.com/profile_images/1620281242/Screen_shot_2011-11-03_at_1.11.35_PM_normal.png",
"https://si0.twimg.com/profile_images/1884069342/BGtwitter_normal.JPG",
"https://si0.twimg.com/profile_images/1766054826/cristian_normal.jpg",
"https://si0.twimg.com/profile_images/2235748695/mrtall_white_bg_normal.png"
],
@andrei512
andrei512 / code.rb
Created September 20, 2012 14:12
comments
def reactions
@article = Article.find(params[:article_id])
comments = @article.comments.includes(:user)
emotions = @article.emotions.includes(:user)
reactions = comments + emotions
reactions.sort! { |x, y|
y.created_at <=> x.created_at
-////////////////////////////////////////////////////////////////////////////////////
- UIImage *maskImg = [UIImage imageNamed:@"Ethics-Risk-Triangle.png"];
- CGImageRef maskRef = maskImg.CGImage;
-
- CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
- CGImageGetHeight(maskRef),
- CGImageGetBitsPerComponent(maskRef),
- CGImageGetBitsPerPixel(maskRef),
- CGImageGetBytesPerRow(maskRef),
- CGImageGetDataProvider(maskRef), NULL, false);
@andrei512
andrei512 / gist:3794449
Created September 27, 2012 14:53
simple API security
before_filter :restrict_access
protected
def restrict_access
if Rails.env != "development"
access_token = request.headers['access_token']
access_token ||= params[:access_token]
begin
@auth = Authorization.find_by_access_token(access_token)