Skip to content

Instantly share code, notes, and snippets.

// an array to hold our parsed shots.
var str = [];
// next we iterate over the shots and find the URL we want to update.
var shots = function() {
$.getShotsByPlayerId( "popular", function(data) {
$.each(data.shots, function( i, shot ) {
var shot_url = shot.image_image_url.replace("http", "https");
str.push('<li><a href="' + shot.url + '"><img src="' + shot_url+ '" alt="' + shot.title + '">');
});
@chrisjdavis
chrisjdavis / ssl-dribbble-urls.php
Last active January 1, 2016 16:49
PHP for replacing http with https in dribbble image URLs
//create a stub to add our parsed shots to.
$str = '';
// here we assume you have already captured the API request content.
$shots = json_decode( $shots );
// next we iterate over the shots and find the URL we want to update.
foreach( $shots->shots as $shot ) {
$shot_url = str_replace( 'http', 'https', $shot->image_url );
$str .= '&lt;li>&lt;a href="' . $shot->url . '">&lt;img alt="' . $shot->title . '" src="' . $shot_url . '"></a></li>';
foreach( $projects->objects as $project ) {
if( $project->date_due ) {
foreach( $project->team as $person ) {
$deets = $blimp->get( 'user', array('url' => $person) );
}
}
}
private function add_templates() {
$this->add_template( 'dash', dirname(__FILE__) . '/templates/dash.php' );
$this->add_template( 'locations', dirname(__FILE__) . '/templates/location.multiple.php' );
$this->add_template( 'new.location', dirname(__FILE__) . '/templates/location.new.php' );
}
public function action_before_act_admin( $that ) {
if( !isset($that->handler_vars['page']) && $that->handler_vars['entire_match'] == 'admin' ) {
Utils::redirect( Site::get_url('admin') . '/dash/' );
}
public function action_modify_form_habari_login(FormUI $form) {
$form->add_class( 'large-7 large-centered columns' );
$form->set_property( 'id', 'login-form' );
$form->remove( $form->title );
$form->remove( $form->reset_message );
$form->habari_username->set_property( 'placeholder', 'Email Address' );
$form->habari_password->set_property( 'placeholder', 'Password' );
$buttons = $form->append( FormControlWrapper::create('buttons')->set_setting('wrap_element', 'ul')->add_class('button-group radius')->set_setting('wrap_each', '<li>%s</li>') );
public function action_modify_form_habari_login(FormUI $form) {
$form->remove( $form->title );
$form->remove( $form->reset_message );
$buttons = $form->append( FormControlWrapper::create('buttons')->set_setting('wrap_element', 'ul')->set_setting('wrap_each', '<li>%s</li>') );
$form->move_into( $form->login, $buttons );
$form->remove( $form->submit_button );
$buttons->append( FormControlSubmit::create('register')->set_caption('Register?')->on_success(function(){ /* do registraion things */}) );
public function theme_route_display_docpage($theme) {
$theme->document = Document::get( array('slug' => $theme->matched_rule->named_arg_values['slug']) );
$theme->page = Page::get( array('document_id' => $theme->document->id, 'name' => $theme->matched_rule->named_arg_values['page']) );
$theme->pages = Pages::get( array('document_id' => $theme->document->id, 'orderby' => 'id ASC') );
$theme->title = $theme->document->title . ' &raquo; ' . $theme->page->title;
$theme->post_id = $theme->page->id;
$i = 0;
$str = '';
$dom = new HTMLDoc( $theme->page->content );
foreach( $dom->find('h4') as $hs ) {
$slug = Utils::slugify( $hs->node->nodeValue );
$heading = $dom->get( $hs );
$heading->id = $slug;
}
@chrisjdavis
chrisjdavis / Rating.Stars.css
Created March 22, 2013 22:50
CSS for Imageless Rating Stars
#stars {
float:left;
width: 100%;
}
#stars p {
text-indent: -99999px;
}
.rating {
float:left !important;
@chrisjdavis
chrisjdavis / Ratings.Stars.html
Created March 22, 2013 22:48
HTML structure for Imageless Rating Stars
<div id="stars">
<p>3.5 stars out of 5</p>
<div class="rating">
<i class="icon-rating bottom hide">z</i>
<i class="icon-rating top"><span class="amount hundred">z</span></i>
</div>
<div class="rating">
<i class="icon-rating bottom hide">z</i>
<i class="icon-rating top"><span class="amount hundred">z</span></i>
</div>