Skip to content

Instantly share code, notes, and snippets.

View naishe's full-sized avatar
🚀
Let's Launch This Thing!

Nishant Neeraj naishe

🚀
Let's Launch This Thing!
View GitHub Profile
// phantomjs code to log in to Amazon
// based on the code from this Stackoverflow answer: http://stackoverflow.com/questions/9246438/how-to-submit-a-form-using-phantomjs
// I'm injecting jQuery so this assumes you have jquery in your project directory
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
#!/bin/bash
# Run this on This AMI on AWS:
# https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-b36981d8
# You should get yourself a fully working GPU enabled tensorflow installation.
cd ~
# grab cuda 7.0
@naishe
naishe / blogpost.yaml
Last active January 12, 2016 02:09 — forked from tjake/blogpost.yaml
Cassandra Stress Test
### DML ###
# Keyspace Name
keyspace: stresscql
# The CQL for creating a keyspace (optional if it already exists)
keyspace_definition: |
CREATE KEYSPACE stresscql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
# Table name
@naishe
naishe / initI18next.ts
Last active July 20, 2020 14:50
Initializing i18next for React Native project
import i18n, {
LanguageDetectorAsyncModule,
Services,
InitOptions,
} from 'i18next';
import {initReactI18next} from 'react-i18next';
import AsyncStorage from '@react-native-community/async-storage';
import * as RNLocalize from 'react-native-localize';
const languageDetector: LanguageDetectorAsyncModule = {
@naishe
naishe / App.tsx
Last active July 21, 2020 07:00
i18next App.tsx file
import React from 'react';
import {SafeAreaView, StyleSheet, View, Text, StatusBar} from 'react-native';
// Localization.ts code can be found here: https://gist.github.com/naishe/a6d9ea9d23214875ac176b63387ab833
import './localization';
import {useTranslation} from 'react-i18next';
declare const global: {HermesInternal: null | {}};
const App = () => {
const {t} = useTranslation();
@naishe
naishe / common.ts
Last active July 21, 2020 11:48
i18next file organization
export default {
ok: 'OK',
cancel: 'Cancel',
};
@naishe
naishe / i18nextConf.ts
Created July 21, 2020 12:36
Configuring i18next for React Native
import i18n, {
LanguageDetectorAsyncModule,
Services,
InitOptions,
} from 'i18next';
import {initReactI18next} from 'react-i18next';
import AsyncStorage from '@react-native-community/async-storage';
import * as RNLocalize from 'react-native-localize';
import en from './en';
import hi from './hi';
@naishe
naishe / LanguageSelector.tsx
Created July 21, 2020 12:57
React Native component to show and change i18next language options
import React from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Dimensions,
} from 'react-native';
import {useTranslation} from 'react-i18next';
@naishe
naishe / i18next-custom-format-partial.ts
Created July 21, 2020 15:18
i18next custom formatting function
interpolation: {
escapeValue: false,
format: function (value: any, format?: string, lng?: string) {
switch (format) {
case 'flags':
if (
typeof value !== 'number' ||
value < 1 ||
!Number.isInteger(value)
@naishe
naishe / AppWrappedInCodePush.tsx
Created August 2, 2020 03:27
Integrating with CodePush 1
import React, {Component} from 'react';
import App from './App';
import codePush from 'react-native-code-push';
class AppWrappedInCodePush extends Component {
render() {
return <App />;
}
}