Skip to content

Instantly share code, notes, and snippets.

View cachrisman's full-sized avatar

Charlie Chrisman cachrisman

View GitHub Profile
function isPrime(num) {
for ( var i = 2; i < num; i++ ) {
if ( num % i === 0 ) {
return false;
}
}
return true;
}
y = 2
@cachrisman
cachrisman / WDI Week 2 problems.js
Created May 9, 2015 01:38
WDI Week 2 problems - Charlie's solutions
// WDI Week 2 problems
// Problem 1: Factorial using recursion
function factorial(n) {
if (n < 0) return "error"; //can't do factorial with negative numbers
else if (n < 2) return 1; //terminal condition
else return factorial(n - 1) * n;
}
console.log("\nfactorial");
console.log(factorial(5)); // => 120
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play>https://s3.amazonaws.com/plivocloud/Trumpet.mp3</Play>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Speak language="en-US" voice="MAN">
Congratulations! You have successfully made a call with Salesforce and Plivo.
</Speak>
<Speak language="fr-FR" voice="WOMAN>
Félicitations! Vous avez réussi à faire un appel en utilisant Salesforce et Plivo.
</Speak>
<Speak language="es-US" voice="MAN">
¡Enhorabuena! Usted ha realizado con éxito una llamada con Salesforce y Plivo.
@cachrisman
cachrisman / diskutil_encrypt_etd.sh
Last active May 18, 2024 22:20
bash script to show speed, data remaining and estimated time to completion of Apple OS X FileVault 2 encryption/decryption process
#!/bin/bash
interval=5 # Sampling time in seconds
volumename="/Volumes/My Passport for Mac/"
total_size=$(diskutil cs info "$volumename" | grep -E "LV Size" | awk '{print $3}')
while [ true ]; do
first_size=$(diskutil cs info "$volumename" | grep -E "LV Bytes Converted" | awk '{print $4}')
sleep $interval
<Response>
<Record callbackUrl="http://requestb.in/1b2uby11" callbackMethod="POST" redirect="false" recordSession="true" />
<Speak language="ru-RU" voice="WOMAN">
&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;, &#1069;&#1090;&#1086; &#1089;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077; &#1086;&#1090; Charlie. &#1052;&#1072;&#1096;&#1080;&#1085;&#1072; &#1079;&#1072; Nixon, &#1087;&#1088;&#1080;&#1077;&#1076;&#1077;&#1090; &#1087;&#1088;&#1080;&#1073;&#1083;&#1080;&#1079;&#1080;&#1090;&#1077;&#1083;&#1100;&#1085;&#1086; &#1074; 10. &#1055;&#1086;&#1078;&#1072;&#1083;&#1091;&#1081;&#1089;&#1090;&#1072;, &#1073;&#1091;&#1076;&#1100;&#1090;&#1077; &#1075;&#1086;&#1090;&#1086;&#1074;&#1099; &#1082; &#1101;&#1090;&#1086;&#1084;&#1091; &#1074;&#1088;&#1077;&#1084;&#1077;&#1085;&#1080;. &#1052;&#1099; &#1042;&#1072;&#1084; &#1087;&#1086;&#1079;&#1074;&#1086;&#1085;&#1080;&#1084; &#1077;&#1097;&#1077; &#1088;&#1072;&#1079; &#1082;&#1086;&#1075;&#1076;&#1072; &#10
<Response>
<Record action="http://requestb.in/1ck1j1y1" startOnDialAnswer="true" redirect="false" />
<Dial>
<Number>13306807074</Number>
</Dial>
</Response>
<Response>
<Dial>
<User>sip:charlie151030230753@phone.plivo.com</User>
</Dial>
</Response>
<?xml version="1.0" encoding="utf-8" ?>
<Response>
<GetDigits action='https://api.properati.com/AR/v3/mistery_shopper/extension' method='POST' numDigits='4' playBeep='true' timeout='10'>
<Speak language='es-ES'>Bienvenido a P.P.N. S.A. Marque el n&amp;#250;mero de interno</Speak>
</GetDigits>
<Wait length='5'/>
</Response>