Skip to content

Instantly share code, notes, and snippets.

Avatar

Jack jackdh

View GitHub Profile
@jackdh
jackdh / useHover.ts
Created Jun 1, 2020
useHover typescript
View useHover.ts
import React, { useEffect, useRef, useState } from "react";
type UseHoverType<T extends HTMLElement> = [React.RefObject<T>, boolean];
function useHover<T extends HTMLElement>(): UseHoverType<T> {
const [value, setValue] = useState(false);
const ref = useRef<T>(null);
const handleMouseOver = () => setValue(true);
View gist:a6bf9f8acf930adc6d17867ec43e2de6
root@CD29UBUNTU:/home/administrator/Downloads/test/RasaTalk# yarn build:dll
yarn run v1.13.0
$ node ./internals/scripts/dependencies.js
Building the Webpack DLL...
Hash: 7abf5469065c09996900
Version: webpack 4.12.0
Time: 17083ms
Built at: 01/28/2019 7:43:27 PM
Asset Size Chunks Chunk Names
reactBoilerplateDeps.dll.js 45.9 MiB reactBoilerplateDeps [emitted] [big] reactBoilerplateDeps
View gist:09ea43612e06bc70cb040c82db45a736
make action-serve;
python -m rasa_core.run -d models / current / dialogue -u models / current / nlu --port 5055 --credentials credentials.yml --verbose
MacBook-Pro-de-igor:RasaTalk igorgadelha$ yarn
yarn install v1.7.0
info No lockfile found.
$ npm run npmcheckversion
@jackdh
jackdh / gist:28224f8a4e5945c1bfe62d1f45cd024b
Created Nov 9, 2018
A few Lat Long helpers. Build waypoints between two waypoints. Measure distance between two points in meters.
View gist:28224f8a4e5945c1bfe62d1f45cd024b
/**
* All lat-long specific operation define here
*
* http://www.movable-type.co.uk/scripts/latlong.html
* Original: https://gis.stackexchange.com/a/265626
* Updated: Jackdh
*/
const _ = require('lodash');
View gist:b78145fce2ce2f3231a88ca409641161
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
const one = [
{
View gist:5c42cbbdab59af8a8ccf9eb51eb7dfc5
{
"rasa_nlu_data": {
"common_examples": [
{
"text": "i want to go marienplatz",
"intent": "FindConnection",
"entities": [
{
"entity": "StationDest",
"start": 13,
View gist:c8d5d06bff76ed46c253
import requests
import mysql.connector
import time
import re
from pprint import pprint
config = {
'user': 'root',
'password': 'root',
'host': 'localhost',
@jackdh
jackdh / gist:9042708
Created Feb 17, 2014
Grab and cache JSON if it is 24 hours old
View gist:9042708
function my_cache_get_event($id){
$url = 'url';
$file = __DIR__.'\cache\user_event_cache_id_'.$id.'.json';
if (time()-filemtime($file) > 24 * 3600) {
// file older than 24 hours
file_put_contents($file, file_get_contents($url));
$json = file_get_contents($file);
return json_decode($json);
} else {
View test.py
import json
with open('questions.json') as f:
questions = json.load(f)
question_number= questions[0] # 0 For getting first question answer set
print(question_number["question"])
#Prints what is 2+2