Skip to content

Instantly share code, notes, and snippets.

@marchawkins
marchawkins / display_fourquare_on_website_with_php.php
Created February 7, 2013 17:55
Display your check-ins from foursquare on a map on your website with php.
<?php
// set default timezone (for date calcutations)
date_default_timezone_set('America/New_York');
// setup array to hold checkins
$checkins = array();
// enter your personal rss feed here (within the quotes); adjust the 'count=5' after the .rss to whatever number of checkins you want to display
$fsquareFeed = 'https://feeds.foursquare.com/history/YOURUNIQUEFOURSQUAREFEEDURL.rss?count=5';
@marchawkins
marchawkins / display_flickr_on_website_with_php.php
Created February 8, 2013 06:21
Display your photos from flickr on your website with php.
<?php
$albumParams = array(
'method' => 'flickr.photos.search',
'user_id' => 'YOURFLICKRUSERID', // find it at http://idgettr.com
'per_page' => '18'
);
$albumInfo = getFlickr($albumParams);
?>
<html>
@marchawkins
marchawkins / flickr_photo_widget.php
Last active December 14, 2015 02:09
Coding a photo widget from designmodo with flickr, php and javascript. Design tutorial is here: http://designmodo.com/instagram-widget-psd/ And my code tutorial is here: http://www.marchawkins.com/notes/flickr-photo-widget
<?php
/* --------------------------------------------
START USER CONFIG -------------------------- */
$flickrUser = 'YOURUSERNAME'; // look at your profile url: http://flickr.com/photos/YOURUSERNAME/
$photoCount = '7'; // the # of photos for the scroller + 1 for top photo (minimum of 3, odd numbers work best)
$flickrAPI = 'YOURFLICKRAPIKEY'; // get yours here: http://www.flickr.com/services/api/keys/apply/
/* END USER CONFIG ----------------------------
@marchawkins
marchawkins / twitter_on_website_with_php.php
Created February 22, 2013 15:48
How-to display your latest twitter tweets on your website with php. Code tutorial here: http://www.marchawkins.com/notes/twitter-on-your-website
<?php
/* if you're having trouble, uncomment this section to show php errors/warnings
error_reporting(E_ALL);
ini_set('display_errors', '1');
*/
// create an array to hold the tweets
$tweets = array();
// enter your twitter username in the screen_name parameter below
@marchawkins
marchawkins / email_cell_phone_via_sms.php
Created February 22, 2013 16:15
How-to send an email to any sms-enabled mobile phone. More info here: http://www.marchawkins.com/notes/send-email-to-sms
<!-- form to send sms -->
<form id="send-email-sms" onsubmit="emailSMS(this); return false;">
<fieldset>
<legend>Email -> SMS Demo</legend>
<div class="row"><div id="response"></div></div>
<div class="row">
<div class="six columns">
<label for="phone_num">Phone #</label><input type="text" name="phone_num" id="phone_num" placeholder="10-digit number, no dashes" maxlength="15" class="inline"/>
</div><!-- .six -->
<div class="six columns">
@marchawkins
marchawkins / annyang-test-01.html
Created February 27, 2014 06:19
** Chrome only ** First test with the [annyang javascript library](https://www.talater.com/annyang/ "annyang javascript library"), a 2k library for allowing users to issue voice commands via their browser. If viewing this page over **http** versus **https**, your browser will ask for permission to use your microphone. The demo will only work if …
<div class="panel panel-default">
<div class="panel-heading">Speech Recognition Status</div>
<div class="panel-body">
<div id="status"></div>
</div>
</div>
<script src="/assets/js/annyang.min.js"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="record-btn"><span>Record</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Dictation Output</div>
<div class="panel-body">
<textarea id="dictation" class="form-control" placeholder="Spoken text will appear here"></textarea>
</div>
@marchawkins
marchawkins / voice-command-time-test.html
Created March 3, 2014 18:58
Using annyang javascript library (https://www.talater.com/annyang/) to capture a command, process it and speak the result with the html 5 speech synthesis api. This demo works on the desktop and Android versions of Chrome. The 'time' is based on the user's system clock For this test, click **Listen** and ask "What time is it?" (after clicking "a…
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="speak-btn"><span>Listen</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Response Status</div>
<div class="panel-body">
<textarea id="status" class="form-control" placeholder="Spoken text will appear here"></textarea>
</div>
@marchawkins
marchawkins / command-get-fuzzy-time.html
Created March 4, 2014 00:12
Using javascript to retrieve a user's time, then convert it to a "fuzzy" value that sounds more conversational (ie. "half past two", "a quarter to seven", etc.). The 'time' is based on the user's system clock. For this test, click the **Get Time** button. The exact time will be displayed in the top field. The "fuzzy" time will be displayed below…
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="get-time-btn"><span>Get Time</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Response Status</div>
<div class="panel-body">
<p>Exact time: <input id="exact-time" type="text" class="form-control"/></p>
<p>Fuzzy time: <textarea id="status" class="form-control"></textarea></p>
@marchawkins
marchawkins / command-get-date.html
Created March 4, 2014 07:51
Some simple javascript to retrieve the current date. The 'time' is based on the user's system clock. For this test, click the **Get Date** button. The date will be displayed and spoken to you.
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="get-date-btn"><span>Get Date</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Response Status</div>
<div class="panel-body">
<p>Current date: <input id="date" type="text" class="form-control"/></p>
</div>