Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View phynet's full-sized avatar
🤘
I said yeah.

Sofia Swidarowicz phynet

🤘
I said yeah.
View GitHub Profile
@phynet
phynet / attributed_UILabel.m
Last active January 13, 2016 08:09
Category to create an attributed label for Obj-c
@implementation UILabel (AttributedLabel)
-(NSAttributedString*)spaceBetweenChars:(int)spaceValue{
NSMutableAttributedString *attributedString;
attributedString = [[NSMutableAttributedString alloc] initWithString:self.text];
[attributedString addAttribute:NSKernAttributeName value:@(spaceValue) range:NSMakeRange(0, 0)];
[self setAttributedText:attributedString];
return self.attributedText;
@phynet
phynet / upload-photo-parse.js
Created February 4, 2016 08:35
This was a JS - HTML that I found in the interwebs and changed it to fit my needs, when Parse was alive did work. RIP.
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<form id='fileupload' name='fileupload' enctype='multipart/form-data' method='post'>
<fieldset>
<input type='file' name='fileselect' id='fileselect'></input>
<input id='uploadbutton' type='button' value='Upload to Parse'/></br></br>
File URL <input type='text' id='resultURL' size='155'></input>
</fieldset>
</form>
@phynet
phynet / cordova-hook-run-script-xcode-for-crashlytics.js
Last active February 4, 2016 15:49
This is a JS-Node Hook Plugin for Cordova, that adds the "Run Script" option in XCODE for CRASHLYTICS. What it does, is to add the PBXBuildFile section in project.pbxproj file. Thanks to my lovely bf for pointing me out to use the global match (g modifier) in the regex part
/**
- Really important: install first npm package 'replace'.
*/
module.exports = function(ctx) {
var apiKey = 'YourApiKey';
var secretKey = 'YourSecretKey';
var shellScript = '\".\/Fabric.framework\/run '+ apiKey + ' '+ secretKey+'\"';
//If you are having troubles with Fabric's path, try to point to where the Fabric.framework is added in your project.
@phynet
phynet / install-node-package-cordova.js
Last active February 8, 2016 08:19
How to install a CL in a node-JS cordova plugin? you may ask. I did the same question. Here it is.
module.exports = function(ctx) {
console.log('Installing npm packgae replace');
var Q = ctx.requireCordovaModule('q');
var deferral = new Q.defer();
var exec = require('child_process').exec;
var child = exec('npm install replace', function(error,stdout,stderr){
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
@phynet
phynet / exec-cordova.js
Created February 17, 2016 08:05
Script to compile cordova project (need a packgae.json and a gulp file)
var path = require('path');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var versioniOS = '@4.0.1';
var versionAndroid = '@5.0.0';
function logError(messageError, messageSpinner){
console.log(messageError);
cli.spinner(messageSpinner, true);
'use strict';
var gulp = require('gulp');
var cordova = require('gulp-cordova');
gulp.task('cordova:init', function() {
gulp.src('./package.json')
.pipe(cordova())
})
{
"cordova": [
[
"plugin",
"add",
"https://descinet.bbva.es/stash/scm/cellsnative/cordova-plugin-deviceinfo.git",
"https://descinet.bbva.es/stash/scm/cellsnative/cordova-plugin-base.git",
"https://descinet.bbva.es/stash/scm/cellsnative/cordova-plugin-html5video.git",
"https://descinet.bbva.es/stash/scm/cellsnative/cordova-plugin-touchid.git",
"https://descinet.bbva.es/stash/scm/cellsnative/cordova-plugin-nativeheader",
@phynet
phynet / XCTAsserts.md
Created February 19, 2016 08:27
List of all XCTAssert Macros found in Xcode

##List of All XCT ASSERT macros used to test in XCODE

  XCTFail(...)
      _XCTPrimitiveFail(self, __VA_ARGS__)
  
  XCTAssertNil(expression, ...) 
      _XCTPrimitiveAssertNil(self, expression, @#expression, __VA_ARGS__)
  
  XCTAssertNotNil(expression, ...) 

_XCTPrimitiveAssertNotNil(self, expression, @#expression, VA_ARGS)

@phynet
phynet / sharing-pods-in-diff-targets.rb
Last active February 23, 2016 14:22
Sharing pods between targets
#platform :ios, '8.0'
def shared_pods
pod 'Parse'
pod 'RNCryptor', '3.0.1', :inhibit_warnings => true
pod 'SSKeychain'
end
target 'MyApp' do
/*
* Example: needed to save a pdf document and show that pdf data in main thread. So using the example:
*/
dispatch_async(dispatch_get_global_queue(0, 0), ^{
//load your data here.
dispatch_async(dispatch_get_main_queue(), ^{
//update UI in main thread.
});
});