Skip to content

Instantly share code, notes, and snippets.

View jackdh's full-sized avatar

Jack jackdh

View GitHub Profile
@jackdh
jackdh / useHover.ts
Created June 1, 2020 12:30
useHover typescript
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);
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
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 November 9, 2018 14:22
A few Lat Long helpers. Build waypoints between two waypoints. Measure distance between two points in meters.
/**
* 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');
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
const one = [
{
{
"rasa_nlu_data": {
"common_examples": [
{
"text": "i want to go marienplatz",
"intent": "FindConnection",
"entities": [
{
"entity": "StationDest",
"start": 13,
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 February 17, 2014 00:31
Grab and cache JSON if it is 24 hours old
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 {
@jackdh
jackdh / test.py
Last active August 29, 2015 13:56
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