Skip to content

Instantly share code, notes, and snippets.

View fonov's full-sized avatar

Fonov Sergei fonov

View GitHub Profile
@ejmartin504
ejmartin504 / AsyncLocalStorage.swift
Created March 19, 2018 21:23
Demonstration of fetching data from React Native AsyncLocalStorage
// 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")
@zntfdr
zntfdr / rainbowSystemColors.swift
Last active November 14, 2019 10:33
A Playground showcasing all the iOS 13 system colors
//
// System Colors Playground
// fivestars.blog
//
// Created by Federico Zanetello on 9/6/19.
//
import UIKit
import PlaygroundSupport
@stig
stig / GitBundleVersionHook
Created August 10, 2013 09:11
Short script to set CFBundleShortVersionString from the latest tag + CFBundleVersion from the number of commits on the master branch. It is useful to use with Jenkins, and doesn't require you to update the repository, so you don't pollute your change history with "updated version" commits.
#!/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
@shinyzhu
shinyzhu / gist:3175082
Created July 25, 2012 08:27
UIColor from hex value in Objective-C
/*
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
@markerikson
markerikson / appEntryPoint.js
Last active August 1, 2022 07:41
Webpack React/Redux Hot Module Reloading (HMR) example
import React from "react";
import ReactDOM from "react-dom";
import configureStore from "./store/configureStore";
const store = configureStore();
const rootEl = document.getElementById("root");
@hoetmaaiers
hoetmaaiers / overview.md
Last active August 29, 2022 07:28
Webstorm live templates

React Native Live Templates for WebStorm

How to add Live Template in Webstorm

  1. open preferences
  2. editor> live templates
  3. add template group for React Native
  4. add templates below to the new group
  5. define context > javascript
  6. edit variables > add "fileNameWithoutExtension" to "$fnName$"
@jpluimers
jpluimers / recursively-convert-wma-to-mp3-using-ffmeg.sh
Created April 14, 2016 21:28
Recursively convert WMA files to MP3 using ffmeg on a Mac OS X bash shell
find . -iname "*.wma" -execdir bash -c 'NAME="{}" && ffmpeg -y -i "$NAME" -ab 192k "${NAME/.wma/.mp3}" -map_metadata 0:s:0 && rm "$NAME"' \;
@simonbromberg
simonbromberg / ListFonts.m
Last active September 6, 2023 03:35
List all fonts available on iOS device in console
// 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);
}
@ankurk91
ankurk91 / npm-commands.md
Last active October 22, 2023 12:16
Useful npm commands and tricks

npm v3.10 - ◾

⚠️ This gist is outdated, but most of the commands are still relevant. ⚠️

Update npm itself

npm install -g npm
# Downgrade to a specific version
npm install -g npm@6