Skip to content

Instantly share code, notes, and snippets.

View sagotsky's full-sized avatar

Jon Sagotsky sagotsky

View GitHub Profile
@sagotsky
sagotsky / slack-export.sh
Last active May 2, 2019 23:39
slack history exporter. override the three vars at the top. run the script for api token and dependency instructions. channels are public and have a # icon. private groups are private and have a lock icon.
#!/bin/bash
PRIVATE_GROUPS="thepit"
CHANNELS="avatar plm_website general health_insurance vim"
USERS="awilkie amonat bryanalves brittneysaint"
if [[ "$SLACK_TOKEN" == '' ]] ; then
echo 'Visit https://api.slack.com/custom-integrations/legacy-tokens to make yourself a slack token'
echo 'Set it with `export SLACK_TOKEN=abc123...`'
echo 'Then rerun this script'
@sagotsky
sagotsky / 0_reuse_code.js
Created May 12, 2016 13:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sagotsky
sagotsky / .Xresources
Created February 27, 2016 02:31
urxvt copy to global clipboard
URxvt.perl-ext-common: font-size,selection-to-clipboard
URxvt.clipboard.autocopy: true
URxvt.clipboard.copycmd: xclip -in -selection clipboard
@sagotsky
sagotsky / sv.md
Created January 9, 2014 20:50
SV list grid planning

Options for how to select:

(these are context dependent - not all content has a grid)

Context dependent selects

Mode: list => Display: [ title, teaser, full ] grid => Display: [ profile, title ]

@sagotsky
sagotsky / password_policy-consecutive_regex-2127421-1.patch
Last active December 27, 2015 11:49
Fixes password_policy's consecutive constraint
diff --git a/plugins/constraint/consecutive.inc b/plugins/constraint/consecutive.inc
index e6c3c3c..f79b7b1 100644
--- a/plugins/constraint/consecutive.inc
+++ b/plugins/constraint/consecutive.inc
@@ -36,6 +36,6 @@ function password_policy_consecutive_admin_form($form, &$form_state, $constraint
* Admin form callback for consecutive character count constraint.
*/
function password_policy_consecutive_constraint($password, $account, $constraint) {
- $pattern = '/(.)[\1]{' . ($constraint->config['consecutive_char_count'] - 1) . '}/';
+ $pattern = '/(.)\1{' . ($constraint->config['consecutive_char_count'] - 1) . '}/';
@sagotsky
sagotsky / getsatisfaction_update_topic.php
Created July 1, 2013 14:07
Updates a topic on getsaitsfaction.
<?php
/*
* Attempting to update a getsatisfaction topic from the api.
*/
set_include_path('/opt/pear');
require_once('HTTP/Request2.php');
$url = 'https://api.getsatisfaction.com/topics/api_topic_test'; //slug works here. haven't tested id.
@sagotsky
sagotsky / diff_exclude
Last active December 15, 2015 06:19
Compares the product of our make file with what's currently checked in to git's SCHOLAR-3.4 branch. Only checks contrib modules.
PATCHES.txt
*.info
@sagotsky
sagotsky / releasenotes.php
Last active December 15, 2015 06:19
Fetches our release notes from git. Only gets issues from the most recent closed milestone that use a specific label ("type: bug" for proof of concept).
<?php
function os_releasenotes() {
$milestones = _os_releasenotes_milestones('closed');
$latest = $milestones[0];
$api_url = 'https://api.github.com/repos/openscholar/openscholar/issues';
//get labeled issues
$params = array('state' => 'closed', 'labels' => 'type: bug', 'milestone' => $latest['number']);
@sagotsky
sagotsky / revert non-overridden.php
Last active December 14, 2015 23:09
Notes for how to revert a feature only if it isn't overriden.
<?
require_once(drupal_get_path('module', 'features')) . '/features.export.inc';
$features_components = features_get_component_states(array('vsite'));
if ($features_components['vsite']['field'] == FEATURES_OVERRIDDEN) {
features_revert(array('vsite' => array('field')));
}
<div class="flexslider 16_9_below">
<ul class="slides">
<li style="width: 100%; float: left; margin-right: -100%; position: relative; display: list-item; opacity: 0.330631;" class="">
<a href="http://example.com"><img width="680" height="383" alt="" src="http://scholar7-1.local/sites/scholar7-1.local/files/styles/os_slideshow_16%3A9_680/public/01209_snoqualmiedew_2560x1600_1.jpg" class="image-style-os-slideshow-169-680" typeof="foaf:Image"></a> <div class="flex-caption">
<h2>Headline! Headline! Headline!</h2>
<p>Lorem ipsum</p>
</div></li>