Skip to content

Instantly share code, notes, and snippets.

//failed
curl --request POST \
> --url http://api.lineopener.com/index.php/api/login \
> --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
> --form [email protected] \
> --form password=test123
//MARK:API
func loginRequest(username:String, password:String) {
activityIndicator.startAnimating()
self.fieldView.endEditing(true) //reset screen
guard let url = URL(string:"http://api.lineopener.com/index.php/api/login") else { return }
let parameters = ["email": username, "password": password]
var request = URLRequest(url: url)
<NSHTTPURLResponse: 0x60400042e540> { URL: http://166.62.92.171/lineopner/index.php/api/login } { Status Code: 200, Headers {
"Cache-Control" = (
"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
);
"Content-Length" = (
56
);
"Content-Type" = (
"application/json"
);
@projectxcappe
projectxcappe / label.swift
Created December 21, 2017 20:21
Dynamic UILabel with Rounded Background
class LabelWithBgImage : UILabel {
var topInset: CGFloat = 0.0
var bottomInset: CGFloat = 0.0
var leftInset: CGFloat = 10.0
var rightInset: CGFloat = 10.0
public override init(frame: CGRect) {
super.init(frame: frame)
}
Venues
{
"venue_name":"John",
"place":30,
"image":null,
"num_restaurants":12
}
- (void)renderComets {
NSArray *strips = PPDeviceRegistry.sharedRegistry.strips;
if (strips.count >= self.numStrips) {
for (NSUInteger s=0; s<self.numStrips; s++) {
PPStrip *strip = strips[s];
for (int i=0; i<strip.pixels.count; i++) {
PPPixel *pix = strip.pixels[i];
pix.red = pix.green = pix.blue = 0;
}
NSMutableArray *stripComets = self.comets[s];
if ((-self.beacon.rssi < strip.pixels.count)) {
pixcount = -self.beacon.rssi;
NSLog(@"1 - %d", pixcount);
}else {
pixcount = strip.pixels.count; //should be 72
NSLog(@"2 - %d", pixcount);
}
/*
UIButton *adButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[adButton setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 50.0f)];
adButton.backgroundColor = [UIColor purpleColor];
//[self.view addSubview:adButton];
@projectxcappe
projectxcappe / gist:1424983
Created December 2, 2011 21:49
this is shit.
- (void)adButtonTapped:(id)sender {
TLLog( @"BCWebAdView:adButtonTapped:sender:%@", sender );
[self _adButtonTapped:sender event:nil];
}
- (void)_adButtonTapped:(id)sender event:(UIEvent *)e {
...
@projectxcappe
projectxcappe / gist:1420583
Created December 1, 2011 23:09
addTarget to another class
//BCWebAdView.m
-(void)testmethod:(id)sender{
NSLog(@"testmethod");
}
//-----------//
//TLAdView.m
#import "TLAdView.h"