Skip to content

Instantly share code, notes, and snippets.

@rohmann
rohmann / functions.php
Last active September 22, 2022 13:27
Pro / Cornerstone Custom Loopers Example
<?php
// NOTE: Unfortunately, this code no longer works because Google has shut down
// their V3 API for Sheets. We used that at the time because it didn't require
// additional setup, nor creating an API key unlike the V4 API.
// This is the new URL syntax, and it requires an API Key
// https://sheets.googleapis.com/v4/spreadsheets/SHEET_ID/values/NAME_OF_SHEET_TAB?alt=json&key=API_KEY
// It isn't compatible with the code below, so you sill still need to write custom PHP to reformat the JSON
@rohmann
rohmann / bp-bulk-add-users.php
Last active November 30, 2021 22:16
Quick users page mod to allow for bulk adding to BuddyPress groups.
<?php
add_action('load-users.php',function() {
if(isset($_GET['action']) && isset($_GET['bp_gid']) && isset($_GET['users'])) {
$group_id = $_GET['bp_gid'];
$users = $_GET['users'];
foreach ($users as $user_id) {
groups_join_group( $group_id, $user_id );
}
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
});
ul.display-posts-listing {
list-style:none;
}
.excerpt-dash {
display:none;
}
.listing-item {
margin-bottom: 2.5em;
@rohmann
rohmann / discourse-secure-note.rb
Last active June 13, 2017 22:25
Discourse Secure Note
# name: discourse-secure-note
# about: Allow the attachment of secure notes to posts that are visible to staff and the post owner.
# version: 0.1
# authors: Alexander Rohmann
# url:
PLUGIN_NAME ||= "discourse_secure-note".freeze
after_initialize do
@rohmann
rohmann / goodbye-skype.sh
Last active March 18, 2017 20:25
Cleanup cmd+tab and the dock by launching apps in the background. You can still open their main windows with Alfred/Spotlight.
# Go away
defaults write "$(mdfind kMDItemCFBundleIdentifier = 'com.skype.skype')/Contents/Info.plist" "LSUIElement" -string "1" && killall Skype
# Come back
defaults write "$(mdfind kMDItemCFBundleIdentifier = 'com.skype.skype')/Contents/Info.plist" "LSUIElement" -string "0" && killall Skype
# If you get any requests to use the keychain, they should go away the next time you restart your mac. You may be asked to sign into Skype again.
@rohmann
rohmann / custom-nav-walker.php
Last active December 12, 2016 23:15
WordPress Custom Nav walker as a template
<?php
/*
I've not tested it, but this is the result of thinking through how one might output custom navigation menu markup using a theme template file.
1. Include this class
2. Call a menu in one of your templates, and reference a template using the new arguments available. For example
wp_nav_menu( array(
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
markup: Ember.computed('state',function(){
return `<div><strong>${this.get('state')}</strong><div><!--morph:yield--></div></div>`;
}),
});
@rohmann
rohmann / app-view.js
Created September 14, 2016 18:50
Add class to Ember Application (after 2.7.0)
// instance-initializers/app-view.js
// With an instance initializer, we can register a component for Ember to use at the top level.
// Not ideal, but it works in the meantime until routable components drop.
import Ember from 'ember';
const AppView = Ember.Component.extend({
classNames: ['my-app'],
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init: function () {
this._super();
Ember.run.schedule("afterRender",this,function() {
this.send("later");
});