Skip to content

Instantly share code, notes, and snippets.

def create
@trail = Trail.new(trail_params)
@trail.user_id = current_user.id
if @trail.save
redirect_to trails_path, notice: "Trail #{@trail.name} was created"
else
render 'new'
end
end
// Manifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
// MainActivity.java
import android.location.LocationManager;
[
{
"action": "talk",
"voiceName": "Russell",
"text": "Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is Russell. You are listening to a text-to-speech Call made with Nexmo's Voice API. Hi, this is
conversation.sendText("Hello World!")
.then(() => console.log('text sent'))
conversation.on("member:media", (member, event) => {
console.log(`*** Member changed media state`, member, event)
})
@ChrisGuzman
ChrisGuzman / install.sh
Last active July 25, 2018 16:48
ruby webhook pre-requisites
gem install sinatra
gem install sinatra-contrib
@ChrisGuzman
ChrisGuzman / install.sh
Created May 7, 2018 14:59
Ruby Nexmo Client pre-reqs
gem install nexmo
[
{
"action": "talk",
"text": "Thank you for calling Chris"
},
{
"action": "connect",
"from": "19177176397",
"endpoint": [
{
@ChrisGuzman
ChrisGuzman / shakespeare.json
Created July 24, 2018 22:18
Shakespeare speaking
[
{
"action": "talk",
"voiceName": "Russell",
"text": "You have done that you should be sorry for. There is no terror, Cassius, in your threats, For I am arm'd so strong in honesty That they pass by me as the idle wind, Which I respect not. I did send to you For certain sums of gold, which you denied me: For I can raise no money by vile means: By heaven, I had rather coin my heart, And drop my blood for drachmas, than to wring From the hard hands of peasants their vile trash By any indirection: I did send To you for gold to pay my legions, Which you denied me: was that done like Cassius? Should I have answer'd Caius Cassius so? When Marcus Brutus grows so covetous, To lock such rascal counters from his friends, Be ready, gods, with all your thunderbolts; Dash him to pieces!"
}
]
@ChrisGuzman
ChrisGuzman / happyNumber.kt
Created April 2, 2020 21:59
LeetCode #2 Happy Number
fun main(args: Array<String>) {
println(isHappy(1111111))
}
fun isHappy(n: Int): Boolean {
val mathed = doTheMath(n)
println(mathed)
return mathed == 1
}