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
# @start snippet | |
require "twilio-ruby" | |
class AppointmentreminderController < ApplicationController | |
# your Twilio authentication credentials | |
ACCOUNT_SID = 'AC1ea915e8d2fb79d9efd01c53b94cdc75' | |
ACCOUNT_TOKEN = 'c72fde4d7af307c610aaa0e5f3c3c9e2' | |
# base URL of this application |
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 urllib | |
from bs4 import BeautifulSoup | |
import sys | |
import nltk | |
from nltk import word_tokenize | |
def splitParagraphIntoSentences(paragraph): | |
''' break a paragraph into sentences | |
and return a list ''' | |
import re |
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
String trackName = '4BYGxv4rxSNcTgT3DsFB9o' //replace this with a call to get the track ID | |
final List<String> tracksToAdd = Arrays.asList("spotify:track:"+trackName); | |
// Index starts at 0 | |
final int insertIndex = 1; | |
final AddTrackToPlaylistRequest request = api.addTracksToPlaylist("thelinmichael", "5ieJqeLJjjI8iJWaxeBLuK", tracksToAdd) | |
.position(insertIndex) |
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
String rawHTML = ; | |
Pattern pattern = Pattern.compile("\D\D\d\s\D\d\d"); | |
Matcher matcher = pattern.matcher(rawHTML); | |
if (matcher.find()) | |
{ | |
System.out.println(matcher.group(1)); | |
} |
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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html class="js" xmlns="http://www.w3.org/1999/xhtml"><head profile="http://www.w3.org/1999/xhtml/vocab"><meta charset="utf-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Search by barcode | GEPIR | Services | GS1 - The global language of business | |
</title> | |
<link type="text/css" rel="stylesheet" href="Search%20by%20barcode%20%7C%20GEPIR%20%7C%20Services%20%7C%20GS1%20-%20The%20global%20language%20of%20business_files/css.css" media="all"><link href="Search%20by%20barcode%20%7C%20GEPIR%20%7C%20Services%20%7C%20GS1%20-%20The%20global%20language%20of%20business_files/main.css" type="text/css" rel="stylesheet" media="screen"><link type="text/css" rel="stylesheet" href="Search%20by%20barcode%20%7C%20GEPIR%20%7C%20Services%20%7C%20GS1%20-%20The%20global%20language%20of%20business_files/3862 |
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
port org.jsoup.Jsoup; | |
String html = "bfbvfvbrbvb <div id='adressscroll'> G74 4GX</div>"; | |
Pattern pattern = Pattern.compile("[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}"); | |
Document doc = Jsoup.parse(html); | |
Element address = doc.select("div.adressscroll").first(); |
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 org.jsoup.Jsoup; | |
public class postcodefinder{ | |
public static void main() { | |
String html = "bfbvfvbrbvb <div id='adressscroll'> G74 4GX</div>";//htmlin | |
Pattern pattern = Pattern.compile("[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][ABD-HJLNP-UW-Z]{2}"); |
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
public GeoPoint getLocationFromAddress(String strAddress){ | |
Geocoder coder = new Geocoder(this); | |
List<Address> address; | |
GeoPoint p1 = null; | |
try { | |
address = coder.getFromLocationName(strAddress,5); | |
if (address == null) { | |
return null; |
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
public getDistance(float latA, float latB, float longA, fload longB){ | |
//Used to find distance between two LatLongs | |
Location locationA = new Location("point A"); | |
locationA.setLatitude(latA); | |
locationA.setLongitude(lngA); | |
Location locationB = new Location("point B"); |
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
float distance = locationA.distanceTo(locationB); | |
distance *= 0.000621371192 | |
return (double)distance |
OlderNewer