Skip to content

Instantly share code, notes, and snippets.

// In App.js in a new project
import React, {useEffect, useState} from 'react';
import {View, Text, Button, TouchableOpacity} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
// import {enableScreens} from 'react-native-screens';
// enableScreens();
const computeResult = () => {
let result = 0;
@saleehk
saleehk / final.js
Created August 11, 2018 05:58
DIalogflow
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
function currentlyOpen () {
var currentDateTime = new Date(); // current time
var hours = currentDateTime.getHours();
var mins = currentDateTime.getMinutes();
var day = currentDateTime.getDay();
return day >= 1 &&
day <= 5 &&
hours >= 9 &&
(hours < 17 || hours === 17 && mins <= 30);
var request = require("request");
var options = {
method: 'GET',
url: '{URL_HERE}',
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
@saleehk
saleehk / download-image.js
Created June 16, 2016 05:21
Download images using chrome
$(".download").each(function () {
url = ($(this).attr("href"));
var a = document.createElement('a');
a.href = url;
a.download = "favicon.png";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
})
@saleehk
saleehk / installer
Created December 26, 2014 20:55
Bash for install LAMP in Centos 7
read -p "MySQL Password: " rootpassword
# Apache php mysql mysql-server installing
echo "Installing httpd"
yum install -y httpd
echo "Installing MYSQL"
yum install -y mariadb-server mariadb
@saleehk
saleehk / build.gradle
Created October 8, 2014 08:23
Simple Gradle file to compile the Project from eclipse
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong