This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ... | |
let ac = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert) | |
ac.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) | |
UIApplication.shared.keywindow?.rootViewController?.presentedViewController?.present(ac, animated: true, completion: nil) | |
/// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alert = UIAlertController(title: "My Alert", message: "This is an alert.", preferredStyle: .alert) | |
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "Default action"), style: .default, handler: { _ in | |
NSLog("The \"OK\" alert occured.") | |
})) | |
self.present(alert, animated: true, completion: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Auto-binding functions | |
*/ | |
import React from 'react'; | |
export default class CustomComponent extends React.Component { | |
// ... | |
autoBindingFunction = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Classic function binding | |
*/ | |
import React from 'react'; | |
export default class CustomComponent extends React.Component { | |
constructor(props) { | |
super(props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name FileListToJson | |
* @description Script to turn the current folder's files list in a array inside a JSON. | |
* @author saulosf - salvarLabs | |
*/ | |
const fs = require('fs') | |
const path = require('path') | |
fs.readdir(__dirname, (err, files) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
""" | |
Renames the filenames within the same directory to be mobile friendly | |
(1) Changes spaces to underscores | |
(2) Makes lowercase | |
Usage: | |
python rename.py | |
source: https://gist.github.com/igniteflow/1226919 | |
modification: @saulosf - salvar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ... | |
if (__DEV__) { | |
/// Dev environment... | |
} else { | |
/// Production environment... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomError extends Error { | |
__proto__ = Error | |
constructor(message: string) { | |
super(message); | |
Object.setPrototypeOf(this, CustomError.prototype); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomError extends Error { | |
/// ... | |
constructor(message: string) { | |
super(message); | |
/// ... | |
} | |
} |