This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="secretInfo" style="display: none;">secret info</div> | |
<button type="button" id="btnCopy">Copy hidden info</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class AddConstraintMyTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$linkField = $('[name="form-link"]'); | |
$sourceField = $('[name="form-source"]'); | |
$linkField.keypress(function() { | |
$tempA = document.createElement('a'); | |
$tempA.href = $linkField.val(); | |
$sourceField.val($tempA.hostname); | |
$tempA.remove(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
var notificationBtn = document.getElementById('notificationBtn'); | |
var notificationBox = document.getElementById('notificationBox'); | |
document.body.addEventListener('click', function(ev) { | |
notificationBox.style.display = 'none'; | |
}); | |
notificationBtn.addEventListener('click', function(ev) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class Print extends React.Component { | |
constructor() { | |
super() | |
this.printStuff = this.printStuff.bind(this); | |
} | |
printStuff() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getQueryParam(param) { | |
// returns the query parameters portion from the url and gets rid of the ? at position [0] | |
var query = window.location.search.substring(1); | |
var startPos = query.indexOf(param); | |
if (startPos == -1) { | |
return false; | |
} | |
query = query.substring(startPos); | |
// checks if the desired param is the last one in the query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
from meya import Component | |
class WitRequest(Component): | |
def start(self): | |
API_KEY = 'XXX' | |
url = 'https://api.wit.ai/message' | |
headers = {'Authorization': 'Bearer ' + API_KEY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: root | |
states: | |
greetings: | |
component: meya.input_string | |
properties: | |
text: Hi, what can I help you with? | |
output: intent | |
wit_request: | |
component: wit_request | |
transitions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
obj = json.loads('{"msg_id":"07kg0Z1uAQMmLN6lM","_text":"i want links to racing and horses","entities":{"links_category":[{"suggested":true,"confidence":0.97013993755778,"value":"racing","type":"value"},{"suggested":true,"confidence":0.94886424860786,"value":"horses","type":"value"}]}}') | |
entities = obj['entities'] | |
intents = [] | |
for key in entities: | |
aux = [] | |
for entity in entities[key]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User: | |
role = 'user' | |
def __init__(self, name): | |
self.name = name | |
def get_name(self): | |
print(self.name) | |
@classmethod |
OlderNewer