Skip to content

Instantly share code, notes, and snippets.

View techieshark's full-sized avatar

Peter W techieshark

View GitHub Profile
@techieshark
techieshark / drupal_vocabs_nodecounts.sql
Created January 10, 2012 23:31
(Drupal) SQL to count #nodes in each term in each vocabulary.
SELECT v.vid, v.name AS Vocabulary, td.tid, td.name AS Term, (SELECT count(*) FROM drupal_node n JOIN drupal_term_node tn2 ON n.nid = tn2.nid WHERE tn2.tid = td.tid) AS Count FROM drupal_vocabulary v JOIN drupal_term_data td ON v.vid = td.vid ORDER BY Count DESC;
@techieshark
techieshark / find.us.sh
Created January 10, 2012 02:12
Bash script to check for unused .us domains.
for i in `cat more.words.us`; do
if [ -z "`dig $i +short`" ]; then
echo $i; echo $i | sed 's/\.//' | xargs dict;
fi;
done;
@techieshark
techieshark / fix_vancouver.csv
Created January 3, 2012 03:27
Location of Vancouver, WA for Managing News
Name Lat Lon Parent
Vancouver 45.63 -122.60 United States
@techieshark
techieshark / fb-event-attendees.html
Created December 8, 2011 02:28
List of people who responded yes/maybe to Facebook event
<html>
<head>
<title>Facebook Evevt Attendees</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="yes.js"></script>
<script type="text/javascript" src="maybe.js"></script>
<script type="text/javascript">
// code modified from http://www.zachhunter.com/2011/06/json-to-csv/
@techieshark
techieshark / git-rebase.log
Created March 9, 2015 23:32
git rebasing municipal
peter@Selene:~/mesa-municipal(master)$ git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 1
Unpacking objects: 100% (7/7), done.
From github.com:CityOfMesaAZ/Municipal
1d0be4e..53f4d71 master -> origin/master
* [new branch] master_bu_03-05-15 -> origin/master_bu_03-05-15
* [new branch] mesa-customized_bu_03-05-15 -> origin/mesa-customized_bu_03-05-15
Updating 1d0be4e..53f4d71
@techieshark
techieshark / console.js
Created February 3, 2015 22:20
ie-console.js
/**
* Protect window.console method calls, e.g. console is not defined on IE
* unless dev tools are open, and IE doesn't define console.debug
* http://stackoverflow.com/a/13817235/1024811
*/
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
@techieshark
techieshark / lots-o-git.sh
Created January 29, 2015 03:19
Cleaning Mesa's downstream repo / syncing with CfA
# This is kind of long. It should be a lot simpler in the future, once these steps are done.
# Clone repo:
git clone https://github.com/CityOfMesaAZ/MuniciPal.git mesa-municipal
# get into repo
cd mesa-municipal
# Add the upstream repository:
git remote add upstream https://github.com/codeforamerica/MuniciPal.git
@techieshark
techieshark / update-council-info.sh
Created January 29, 2015 03:14
Syncing techieshark -> mesa Council Info:
git clone git@github.com:CityOfMesaAZ/council-info.git mesa-council-info
cd mesa-council-info/
git remote -v #view remotes already setup. looks like we need to add one:
git remote add techieshark https://github.com/techieshark/council-info.git
git fetch techieshark gh-pages
git merge techieshark/gh-pages
git push #push to origin with the new additions
@techieshark
techieshark / find-twitters.js
Created December 12, 2014 23:57
get-all-twitter-links
// first make sure jQuery and Lo-Dash are in the browser by running https://gist.github.com/techieshark/45d6f183f80835757336
var links = _.map($('a'), function(a) { return $(a).attr('href')});
var twitters = _.filter(links, function(l) { return l && l.match(/twitter/) });
twitters.join('\n');
@techieshark
techieshark / gist:7d6d7c851efe80829d93
Created November 24, 2014 22:35
follow-all-error
2014-11-24T22:17:42.216842+00:00 heroku[router]: at=info method=POST path="/follows" host=techieshark-follow-all.herokuapp.com request_id=1c90e2bf-a27f-4723-9cf4-ca522eec4987 fwd="24.5.76.148" dyno=web.1 connect=2ms service=493ms status=500 bytes=1669
2014-11-24T22:17:42.210119+00:00 app[web.1]: Completed 500 Internal Server Error in 476ms
2014-11-24T22:17:42.213234+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/faraday-0.9.0/lib/faraday/response.rb:9:in `block in call'
2014-11-24T22:17:42.213225+00:00 app[web.1]:
2014-11-24T22:17:42.213231+00:00 app[web.1]: Twitter::Error::Unauthorized (Read-only application cannot POST.):
2014-11-24T22:17:42.213232+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/twitter-5.13.0/lib/twitter/rest/response/raise_error.rb:15:in `on_complete'
2014-11-24T22:17:42.213239+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/faraday-0.9.0/lib/faraday/request/multipart.rb:14:in `call'
2014-11-24T22:17:42.213235+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/faraday-0.9.0/lib/far