Skip to content

Instantly share code, notes, and snippets.

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>') );
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/' );
}
foreach( $projects->objects as $project ) {
if( $project->date_due ) {
foreach( $project->team as $person ) {
$deets = $blimp->get( 'user', array('url' => $person) );
}
}
}
@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>';
// 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('&lt;li>&lt;a href="' + shot.url + '">&lt;img src="' + shot_url+ '" alt="' + shot.title + '">');
});
@chrisjdavis
chrisjdavis / offscreen.m
Last active November 30, 2016 04:48
Creating windows offscreen for fun and profit.
- (IBAction)getImageFromWeb:(id)sender {
// grab the width and height of the document in our mobileView.
CGSize contentSize = CGSizeMake(
[[mobileView stringByEvaluatingJavaScriptFromString:@"document.body.scrollWidth;"] floatValue],
[[mobileView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] floatValue]
);
// create a new window, offscreen.
NSWindow *hiddenWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect( -1000,-1000, contentSize.width, contentSize.height )
styleMask: NSTitledWindowMask | NSClosableWindowMask backing:NSBackingStoreNonretained defer:NO];
@chrisjdavis
chrisjdavis / gist:8599255
Created January 24, 2014 15:19
New Features in Two 1.1
What's not new? Bug fixes, UI tweaks and new features oh my!
With this release we focused on adding features that our power users most requested!
* Convert your mobile view to a PNG and save it to your Desktop!
* Manage your breakpoints! Don't care about screens that are 360 pixels wide? Delete it!
* Custom User Agents! We have added the ability to set the user agent of the mobile view. You can also manage these via app Preferences!
@chrisjdavis
chrisjdavis / gist:33c9f99f40fdc7179cfa
Created August 29, 2014 18:46
Barebones Grunt File
module.exports = function(grunt) {
grunt.initConfig({
concat: {
options: {
separator: '',
},
dist: {
src: ['../scripts/*.functions.js'],
dest: '../js/application.js',
},
@chrisjdavis
chrisjdavis / example.php
Created November 14, 2018 18:55
Example payload
$args = [
[
'account' => 'eosio',
'name' => 'newaccount',
'authorization' => [['actor' => 'eosio', 'permission' => 'active']],
'data' => [
'creator' => 'eosio',
'name' => $account_n,
'owner' => [
'threshold' => 1,
@chrisjdavis
chrisjdavis / create_account.php
Last active November 14, 2018 19:10
Full method, for context
public function create_account($vars, $type) {
$api = ( new \BlockMatrix\EosRpc\ChainFactory )->api();
$walapi = ( new \BlockMatrix\EosRpc\WalletFactory )->api();
$eos = ( new \BlockMatrix\EosRpc\EosRpc( $api, $walapi) );
$walapi->unlock( [self::WALLET_NAME, self::WALLET_PASS] );
$eos->setWalletInfo( self::WALLET_NAME, self::WALLET_PASS );
switch( $type ) {
case self::USER_TYPE_ACCOUNT :