Skip to content

Instantly share code, notes, and snippets.

View tripflex's full-sized avatar
🦋
in the zone

Myles McNamara tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / ttchat
Created August 1, 2011 18:01
Turntable Chat Window
$('.chat-container').appendTo('body').width((($(window).width()-$('#outer').width())/2)+'px').height($('#outer').height()+'px').css('top','0').css('left','0'); $('.messages').height(($('#outer').height()-40-25)+'px'); $('.message').width('100%'); $('.messages').bind('DOMNodeInserted',function(){$(this).find('.message').last().width('100%');}); $('.playlist-container').height(($('#outer').height()-40-56)+'px'); $('.queueView').height(($('#outer').height()-40-82)+'px'); $('.songlist').height(($('#outer').height()-40-125)+'px');
@tripflex
tripflex / autodj.bookmarklet.js
Created August 1, 2011 18:05 — forked from azoff/autodj.bookmarklet.js
Turntable.fm DJ Script
javascript:(function(g,d,f){if(f)d.info("Session found:",f);else return d.warn("No session found!");var h={check:10,wait:500},b=g.autodj={api:g[f],available:function(a){return b.api.taken_dj_map[a]<0},spot:function(){return b.api.become_dj.data("spot")},become:function(a){b.api.callback("become_dj",a)},waiter:function(a){return function(){return b.available(a)?(b.become(a),a):(d.info("Waiting..."),-1)}},seated:function(a){return b.api.djs[a]&&b.api.djs[a][0]===b.api.myuserid},wait:function(a,c){var e=c!==void 0,
a=a||h.check,c=c||b.spot();b.seated(c)?d.warn("Spot",c,"taken!"):(e&&d.error("Spot",c,"missed. Restarting..."),d.info("Polling @",a,"ms"),b.check(a,b.waiter(c)))},check:function(a,c){setTimeout(function(){var e=c.call(b);e>0?(d.warn("Spot",e,"open..."),setTimeout(function(){b.wait(a,e)},h.wait)):b.check(a,c)},a)}}})(window,console,function(g,d,f,h,b,a,c,e,i,j,k){try{return g(d)[f](h)[b][a][c][e]()[i](j)[k]}catch(l){return null}}(jQuery,".invite_dj","data","events","click",0,"handler","toString","match
@tripflex
tripflex / gist:6189586
Created August 8, 2013 22:54
menu sections
<?php
#count all sections and go through each one to create a menu
for ($i = 0; $i < count($sections); $i++) {
echo '<li'.($s == $sections[$i] ? ' class="current_page_item">' : '>');
echo '<a href="/'.$sections[$i].'"><span><strong>'.$sectionstitle[$i].'</strong><span class="navi-description">'.$sectionssubtitle[$i].'</span></span></a>';
echo '<ul class="sub-menu">';
# search through current section to build sub-menu items
$section = $sections[$i];
foreach ($$section as $submenukey => $submenuvalue){
echo '<li><a href="/'.$section.'/'.$submenukey.'"><span>'.$submenuvalue.'</span></a></li>';
<Response>
<Speak voice="WOMAN">
Thank you for calling the Third Party Verification Secure Terminal regarding the Bob Electric Customer Choice Program. For your protection and quality assurance, this call will be recorded.
</Speak>
<Speak voice="MAN">
Thank you for calling the Third Party Verification Secure Terminal regarding the Bob Electric Customer Choice Program. For your protection and quality assurance, this call will be recorded.
</Speak>
</Response>
<Response>
<Speak>Next recording! Yay you made it!</Speak>
<Speak>Thats so fucking cool im so glad we switched</Speak>
<Wait length="3" />
<Speak>3 seconds of silence could do you good. Now some music.</Speak>
<Play>http://com.twilio.music.classical.s3.amazonaws.com/Mellotroniac_-_Flight_Of_Young_Hearts_Flute.mp3</Play>
</Response>
// LOAD AJAX PAGES
function loadURL(url, container) {
$.ajax({
type: "GET",
url: url,
dataType: 'html',
cache: true,
beforeSend: function(){
container.html('<h1><i class="fa fa-cog fa-spin"></i> Loading...</h1>').fadeIn('fast');
},
<Response>
<Hangup schedule="900"/>
<Wait length="2"/>
<Speak voice="WOMAN" language="en-US">
Thank you for calling the T P V Secure Terminaal. For your protection and quality assurance, this call will be recorded.
</Speak>
<Redirect>http://tpv.st/tel/app/8/step/1</Redirect>
</Response>
@tripflex
tripflex / price-table-rcp.php
Created February 18, 2014 18:31
RCP Price Table Template for Jobify
<h2 style="margin-bottom: 0px;">
<span class="rcp_price" rel="<?php echo esc_attr( $level->price ); ?>">
<?php
if ($level->fee) {
$adjusted_price = (($level->price)+($level->fee));
echo $adjusted_price > 0 ? rcp_currency_filter( $adjusted_price ) : __( 'free', 'jobify' );
?>
</h2>
<small>*<?php echo rcp_currency_filter( $level->price ); ?> after first <?php echo $level->duration; ?> days.</small>
<?php
@tripflex
tripflex / gist:1b3adfe40e2ad4f41313
Last active August 29, 2015 14:01
Pods Frontend Shortcode to display Custom Post Type for current user
// Shortcode can be added like this
// [pods_by_current_user_cpt name="document" template="Document Template"]
//
// Supports all shortcode attributes from standard PODS shortcode:
// http://pods.io/docs/learn/shortcodes/pods/
add_shortcode( 'pods_by_current_user_cpt', 'pods_by_current_user_cpt' );
function pods_by_current_user_cpt( $atts, $content = null ) {
$current_user = wp_get_current_user();
@tripflex
tripflex / gist:6053f881a46c3b57e435
Created May 14, 2014 14:27
Pods form display/output user meta field (using label) when not added under User in Pods
$user = wp_get_current_user();
$pod = pods('user', $user->ID);
$out = $pod->form(array(
'first_name' => array(
'label' => 'First name',
'type' => 'text',
'options' => array(
'required' => true,
),
),