How to add Live Template in Webstorm
- open preferences
- editor> live templates
- add template group for React Native
- add templates below to the new group
- define context > javascript
- edit variables > add "fileNameWithoutExtension" to "$fnName$"
// Since AsyncLocalStorage API is not exposed to native code, we have to grab the data ourselves. | |
// If you have been able to get Cocoapods use_frameworks! to work, you can `import React` | |
// Else make sure to include the following in your brindging header: | |
// #import <React/RCTAsyncLocalStorage.h> | |
import Foundation | |
class CacheManager { | |
let storageLocation = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("RCTAsyncLocalStorage_V1") |
// | |
// System Colors Playground | |
// fivestars.blog | |
// | |
// Created by Federico Zanetello on 9/6/19. | |
// | |
import UIKit | |
import PlaygroundSupport |
#!/bin/sh | |
# This script automatically sets the version and short version string of an | |
# Xcode project from the Git repository containing the project. | |
# | |
# To use this script in Xcode 4, add the contents to a "Run Script" build | |
# phase for your application target. | |
set -o errexit | |
set -o nounset |
/* | |
UIColor from hex value in Objective-C | |
*/ | |
#define UIColorFromRGB(rgbHex) [UIColor colorWithRed:((float)((rgbHex & 0xFF0000) >> 16))/255.0 green:((float)((rgbHex & 0xFF00) >> 8))/255.0 blue:((float)(rgbHex & 0xFF))/255.0 alpha:1.0] | |
// Usage: | |
UIColor *bgColor = UIColorFromRGB(0xCCEEFF); |
const bip39 = require("bip39"); | |
const bip32 = require("ripple-bip32"); | |
const ripple = require('ripple-keypairs') | |
var mnemonic = 'novel matter final only nice cheese address cradle civil crash great flame struggle consider crowd surface purpose saddle mango endless mixed trial tape wrap' | |
// Or generate: | |
// mnemonic = bip39.generateMnemonic() | |
console.log('mnemonic: ' + mnemonic) | |
const seed = bip39.mnemonicToSeed(mnemonic) // add second argument for 25th word encrypted |
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import configureStore from "./store/configureStore"; | |
const store = configureStore(); | |
const rootEl = document.getElementById("root"); |
find . -iname "*.wma" -execdir bash -c 'NAME="{}" && ffmpeg -y -i "$NAME" -ab 192k "${NAME/.wma/.mp3}" -map_metadata 0:s:0 && rm "$NAME"' \; |
// List all fonts on iPhone | |
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
for (NSString *family in familyNames) { | |
NSLog(@"Family name: %@", family); | |
fontNames = [UIFont fontNamesForFamilyName: family]; | |
for (NSString *font in fontNames) { | |
NSLog(@" Font name: %@", font); | |
} |
npm install -g npm
# Downgrade to a specific version
npm install -g npm@6