Skip to content

Instantly share code, notes, and snippets.

View khadorkin's full-sized avatar

Dima Khadorkin khadorkin

  • Mobile Roadie
  • Vilnius, Lithuania
  • 00:43 (UTC +03:00)
View GitHub Profile

Tweaking The Navigation / Status Bar In NativeScript

exports.loaded = function(args) {

  var page = args.object;
  page.bindingContext = feedModel;

var controller = frameModule.topmost().ios.controller;

import platform = require("platform");
import application = require("application");
export enum Length {
Short = 2000,
Long = 3500
}
export function show(message: string, length: Length = Length.Long) {
if (platform.device.os === platform.platformNames.android) {
@khadorkin
khadorkin / react-native.d.ts
Last active September 14, 2015 11:34 — forked from bparadie/react-native.d.ts
Incomplete react-native.d.ts, requires react.d.ts from DefinitelyTyped
declare module "react-native" {
import * as React from 'react';
import {ComponentClass, ReactType, ReactNode, ReactElement} from 'react';
export * from 'react';
/**
* Represents the completion of an asynchronous operation
* @see lib.es6.d.ts
@khadorkin
khadorkin / gist:fb1ed50267f85188f23a
Created October 10, 2015 10:45 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@khadorkin
khadorkin / .gitconfig
Created October 29, 2015 23:44 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
package com.yourapp.rctgeolocation;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@khadorkin
khadorkin / GoogleMap.js
Created November 3, 2015 18:47 — forked from cosmith/GoogleMap.js
MapView Android
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule GoogleMapView
* @flow
@khadorkin
khadorkin / adler32.js
Created November 28, 2015 17:40 — forked from mourner/adler32.js
Adler 32 checksum implementation in JS
function hash(str) {
for (var i = 0, len = str.length, s1 = 1, s2 = 0; i < len; i++) {
s1 = (s1 + str.charCodeAt(i)) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
@khadorkin
khadorkin / FacebookTabBar.js
Created December 2, 2015 18:04
FacebookTabBar
'use strict';
var React = require('react-native');
var {
StyleSheet,
Text,
View,
TouchableOpacity,
NavigatorIOS,
@khadorkin
khadorkin / mixin.coffee
Created March 14, 2016 11:43 — forked from valff/mixin.coffee
React.Component Mixin
createMergedResultFunction = (f, g) ->
->
[a, b] = [f.apply(this, arguments), g.apply(this, arguments)]
return b unless a?
return a unless b?
Object.assign({}, a, b)
createChainedFunction = (f, g) ->
->