Skip to content

Instantly share code, notes, and snippets.

@odemolliens
odemolliens / compression.swift
Created Feb 8, 2018 — forked from jaumevn/compression.swift
Video Compression in Swift
View compression.swift
func compress(videoPath : String, exportVideoPath : String, renderSize : CGSize, completion : (Bool) -> ()) {
let videoUrl = NSURL(fileURLWithPath: videoPath)
if (!existsFileAtUrl(videoUrl)) {
completion(false)
return
}
let videoAssetUrl = AVURLAsset(URL: videoUrl, options: nil)
View gist:ced6c5a3a31edfd089e3ba0dd73ad8d6
Request URL:https://api.quickblox.com/login.json
2017-03-16 14:28:23.594 streetiesapp[47297:2713073] [QBCore] Request method: POST
2017-03-16 14:28:23.594 streetiesapp[47297:2713073] [QBCore] Request parameters:{
keys = {
token = EAAGA20NDBUsBAKmhxqBaBOfm0QBuR3gEVjk9Foj2hm1EW5bzGLgptwh4T6DVb0395YyN3ZAQ4t2FeUONzx4Yg1fpeNKBY4FdZA3dI7ZBQic4uZCtEWUUxqZAqhgA6EwDIGXSUJlZAoMOqGoFwCv8ZCZA581CsqS7T2PBIhJNxu4HllnZBNMOcQWNd7BSNWeGBmFFOQ6p8yTNoEmLyV8khkSMkoY8dXmEmO5ys4wRTCif6ygZDZD;
};
provider = facebook;
}
2017-03-16 14:28:23.595 streetiesapp[47297:2713073] [QBCore] Request headers: {
"Accept-Language" = "en;q=1";
View gist:8979729a08302a8da78bbd6a60e6e85f
token:EAAGA20NDBUsBACpi2eZBNcSuFKReqMHmUbCJ6n5vDP6IiOsWLtiiP6SfZA69aBObFxkaCmFn97AU2dAm0FwiZAZAKj1vJNWP7sCQZB15suYtgZBvu3AZBGZAbIJyz1PwnM4ZB2hY6dhlhTc1jBZCePJAOqYPSwQmh6vg7IeBXNyGDUi5BMbKKeuPSY3Yo4zN642oVnQSH82LBiewo3JSjSSnZBR
D/QBASDK: =========================================================
=== REQUEST ==== 3f5adf47-29ac-414f-9046-6ed08d4c78d6 ===
REQUEST
POST https://api.quickblox.com/login.json
HEADERS
QuickBlox-REST-API-Version=0.1.1
QB-SDK=Android 3.3.0
PARAMETERS
provider=facebook
@odemolliens
odemolliens / ExportKindle.js
Created Mar 2, 2017 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
View ExportKindle.js
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '2', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@odemolliens
odemolliens / sim-run.sh
Created Dec 23, 2016 — forked from shazron/sim-run.sh
Run Xcode Simulator project from the command line XCode 8
View sim-run.sh
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@odemolliens
odemolliens / gist:a948bafbaf06bbf8c72f993cdfb1395d
Created Dec 12, 2016 — forked from axierjhtjz/gist:94543264bbe3b9d94d26
Shared OkHttp application Interceptor that will add or intercept E-Tag hash for ALL requests on client instance
View gist:a948bafbaf06bbf8c72f993cdfb1395d
// by Nikola Despotoski
import android.content.Context;
import android.text.TextUtils;
import com.squareup.okhttp.Headers;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
@odemolliens
odemolliens / .swift
Created Oct 5, 2016
iOS Swift dashed lines extension
View .swift
public let kShapeDashed : String = "kShapeDashed"
extension UIView {
func removeDashedBorder(_ view: UIView) {
view.layer.sublayers?.forEach {
if kShapeDashed == $0.name {
$0.removeFromSuperlayer()
}
}
@odemolliens
odemolliens / BridgingHeader.h
Created Sep 21, 2016 — forked from zgchurch/BridgingHeader.h
Using SQLite3 from Swift
View BridgingHeader.h
// 1. Create this file in your Xcode project
// 2. Go to "Build Settings" and find "Objective-C Bridging Header." Use the search bar to find it quickly.
// 3. Double-click and type "BridgingHeader.c"
// If you get "Could not import Objective-C Header," try "my-project-name/BridgingHeader.h"
// 4. Go to "Build Phases," "Link Binary With Libraries," and add libsqlite3.0.dylib
#include <sqlite3.h>
@odemolliens
odemolliens / FileUploader.swift
Last active Aug 11, 2016 — forked from ncerezo/FileUploader.swift
Alamofire multipart upload
View FileUploader.swift
//
// FileUploader.swift
//
// Copyright (c) 2015 Narciso Cerezo Jiménez. All rights reserved.
// Largely based on this stackoverflow question: http://stackoverflow.com/questions/26121827/uploading-file-with-parameters-using-alamofire/28467829//
import Foundation
import Alamofire
private struct FileUploadInfo {
@odemolliens
odemolliens / multipleRows.mm
Last active Apr 4, 2016 — forked from suda/multipleRows.mm
Multiple Row Selection in UIPickerView
View multipleRows.mm
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
UITableViewCell *cell = (UITableViewCell *)view;
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
[cell setBackgroundColor:[UIColor clearColor]];
[cell setBounds:CGRectMake(0, 0, cell.frame.size.width - 20, 44)];
cell.tag = row;
UITapGestureRecognizer * singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleSelection:)];
singleTapGestureRecognizer.numberOfTapsRequired = 1;
[cell addGestureRecognizer:singleTapGestureRecognizer];