Skip to content

Instantly share code, notes, and snippets.

View lfarah's full-sized avatar

Lucas Farah lfarah

  • Awesome Labs
  • São Paulo
View GitHub Profile
//
// MeetingProfileViewController.swift
// InviteMeu
//
// Created by Lucas Farah on 7/15/14.
// Copyright (c) 2014 Hackaton. All rights reserved.
//
import UIKit
{
NSURL *url = [[NSURL alloc]initWithString:@"http://sistemas.ideastek.com.br/cnordeste/gols_jogadores.xml"];
NSXMLParser *parser = [[NSXMLParser alloc]initWithContentsOfURL:url];
[parser setDelegate:self];
BOOL result = [parser parse];
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
NSLog(@"Did start element");
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
// do some task
dispatch_async(dispatch_get_main_queue()) {
// update some UI
class get_user:
def GET(self, user):
answer = ""
if isinstance(user, numbers.Integral):
answer = str(int(user)*3)
else:
answer = user + " potato"
return answer
@lfarah
lfarah / gist:544153db5b410b2ec6b6
Created April 8, 2015 06:41
Testing Flask and Python
from flask import Flask,request,jsonify
import json
app = Flask(__name__)
@app.route('/hello')
def api_hello():
if 'name' in request.args:
list = [
{'name': request.args['name'], 'age': request.args['age']},
{u'name': u'README.md', u'encoding': u'base64', u'url': u'https://api.github.com/repos/vsouza/awesome-ios/contents/README.md?ref=master', u'html_url': u'https://github.com/vsouza/awesome-ios/blob/master/README.md', u'download_url': u'https://raw.githubusercontent.com/vsouza/awesome-ios/master/README.md', u'content': u'IyBBd2Vzb21lIGlPUwoKQSBjdXJhdGVkIGxpc3Qgb2YgYXdlc29tZSBpT1Mg\nZnJhbWV3b3JrcywgbGlicmFyaWVzLCB0dXRvcmlhbHMsIHBsdWdpbnMgWGNv\nZGUsIGNvbXBvbmVudHMgYW5kIG11Y2ggbW9yZS4gClRoZSBsaXN0IGlzIGRp\ndmlkZWQgaW50byBjYXRlZ29yaWVzIHN1Y2ggYXMgRnJhbWV3b3JrcywgQ29t\ncG9uZW50cywgVGVzdGluZyBhbmQgb3RoZXJzLCAgb3BlbiBzb3VyY2UgcHJv\namVjdHMsIGZyZWUgYW5kIHBhaWQgc2VydmljZXMuIFRoZXJlIGlzIG5vIHBy\nZS1lc3RhYmxpc2hlZCBvcmRlciBvZiBpdGVtcyBpbiBlYWNoIGNhdGVnb3J5\nLCB0aGUgb3JkZXIgaXMgZm9yIGNvbnRyaWJ1dGlvbi4gSWYgeW91IHdhbnQg\ndG8gY29udHJpYnV0ZSwgcGxlYXNlIHJlYWQgdGhlIFtndWlkZV0oaHR0cHM6\nLy9naXRodWIuY29tL3Zzb3V6YS9hd2Vzb21lLWlvcy9ibG9iL21hc3Rlci9D\nT05UUklCVVRJTkcubWQpLgoKUHJvamVjdHMgaW4gU3dpZnQgbGFuZ3VhZ2Ug\nd2lsbCBiZSBtYXJrZWQgd2
@lfarah
lfarah / 0_reuse_code.js
Created September 23, 2015 07:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="frA-MV-rdW">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<customFonts key="customFonts">
<mutableArray key="Quicksand-Bold.otf">
// TODO: Write some awesome Swift code, or import libraries like "Foundation",
// "Dispatch", or "Glibc"
print("Hello world!")
var i = 0
while(i<10)
{
print("hey")
i++
[[{"homeScore": 0, "player": "G.Gano", "description": "G.Gano kicks 65 yards from CAR 35 to end zone, Touchback.", "yardLine": 65, "team": "Carolina Panthers", "down": 0, "awayScore": 0, "time": "15:00", "playType": "Kickoff"}, {"homeScore": 0, "player": "T.Brady", "description": "(15:00) T.Brady pass short left to J.Develin to NE 27 for 7 yards (K.Coleman; L.Kuechly).", "yardLine": 80, "team": "Carolina Panthers", "down": 1, "awayScore": 0, "time": "15:00", "playType": "Pass Reception"}, {"homeScore": 0, "player": "J.Gray", "description": "(14:23) J.Gray up the middle to NE 28 for 1 yard (L.Kuechly; K.Ealy).", "yardLine": 73, "team": "Carolina Panthers", "down": 2, "awayScore": 0, "time": "15:00", "playType": "Rush"}, {"homeScore": 0, "player": "T.Brady", "description": "(13:50) (Shotgun) T.Brady pass incomplete deep left to S.Chandler. Penalty on NE-S.Mason, Illegal Use of Hands, declined.", "yardLine": 60, "team": "Carolina Panthers", "down": 3, "awayScore": 0, "time": "15:00", "playType": "Pass Incompleti