Skip to content

Instantly share code, notes, and snippets.

@krschmidt
krschmidt / recent-edits.sql
Last active November 7, 2015 23:38
Recent Logins and Edits to Drupal
# users without any recent edits
select u.name, u.mail, n1.uid, n1.vid, n1.nid, from_unixtime(n1.timestamp) changed
from node_revision n1, users u
where n1.uid = u.uid
and timestamp=
(select max(timestamp)
from node_revision n2
where n2.uid=n1.uid) # this selects the most recent revision for each person
and from_unixtime(n1.timestamp) < date_sub(now(), interval 30 day)
and u.status = 1 # ignore people who are blocked
@krschmidt
krschmidt / convert.sql
Created October 10, 2015 18:21
Single user local to CAS
update users set name='username' where uid=user-id;
insert into cas_user (uid, cas_name) values (user-id, 'username');
@krschmidt
krschmidt / convertusers.sql
Created October 10, 2015 18:08
LDAP to CAS Converstion
INSERT INTO cas_user (uid, cas_name)
SELECT u.uid AS uid, u.name as cas_name
FROM users u
WHERE uid <> 0 AND
NOT EXISTS (SELECT cas_name FROM cas_user c WHERE c.cas_name = u.name) AND
u.name NOT LIKE "L0%";
@krschmidt
krschmidt / brace.css
Last active January 17, 2016 05:40
Horizontal Curly Brace - works in Chrome 41
.item {
width: 200px;
}
.top {
margin-bottom: -8px;
text-align: center;
}
.borders {
border-bottom: black solid 1px;
border-left: black solid 1px;
@krschmidt
krschmidt / delete_term_and_nodes.php
Last active August 29, 2015 14:10
Drush script to delete a taxonomy term and its children, as well as all nodes with that term
<?php
//Enter the taxonomy term ID you want to delete
$termid = -1;
$allterms = taxonomy_get_children($termid);
$allterms[] = $termid;
echo "Deleting $termid and its children\n";
echo "Deleting " . count($allterms) . " terms\n";
@krschmidt
krschmidt / gist:ec145651299ea34b4aba
Last active August 29, 2015 14:09
Mirroring a section of a Drupal website
wget --mirror --page-requisites --adjust-extension --convert-links -e robots=off --accept-regex '.*(section|/sites/default/files).*' --directory-prefix=section http://www.example.com/section
@krschmidt
krschmidt / WeeksElapsed.html
Last active August 29, 2015 14:02
Weeks Elapsed + % Elapsed
<html>
<head>
<title>Weeks Elapsed</title>
</head>
<body>
<div id="container" style="width:100%; height:50px; border:1px solid black;">
<div id="progress-bar" style="width:50%;
background-color:black;
height:50px;">
</div>