Skip to content

Instantly share code, notes, and snippets.

View rissajeanne's full-sized avatar

Marissa Yuen rissajeanne

  • Agathon Group
  • Arizona, USA
View GitHub Profile
// Option A: reset maximum-scale on blur
var viewportMeta = $('meta[name="viewport"]');
$('select[name="filter"]').bind('focus blur', function(event) {
viewportMeta.attr('content', 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1));
});
// Option B: limit maximum-scale to 1
var viewportMeta = $('meta[name="viewport"]');
@rissajeanne
rissajeanne / svnd
Created November 15, 2011 19:37
svn diff vim output script
#!/bin/bash
# Author: Marissa Hogue <marissa@agathongroup.com>
# Last updated: 11/15/2011
# Pipes various 'svn diff' output to vim
show_usage() {
echo "Usage: svnd <revision> <file>"
echo
echo "Examples:"
echo " svnd # get diff for working copy"
CREATE TABLE IF NOT EXISTS `exp_rating_stats` (
`stat_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`entry_id` int(10) unsigned NOT NULL DEFAULT '0',
`channel_id` int(4) unsigned NOT NULL DEFAULT '0',
`member_id` INT UNSIGNED NOT NULL DEFAULT 0,
`collection` varchar(50) NOT NULL,
`last_rating_date` int(10) unsigned NOT NULL DEFAULT '0',
`count` int(10) unsigned NOT NULL DEFAULT '0',
`sum` int(10) unsigned NOT NULL DEFAULT '0',
`avg` float unsigned NOT NULL DEFAULT '0',
// exp_rating_stats
ALTER TABLE `exp_rating_stats` CHANGE `weblog_id` `channel_id` int(4) unsigned NOT NULL DEFAULT '0', CHANGE `form_name` `collection` varchar(50) NOT NULL, CHANGE `rating_date` `last_rating_date` int(10) unsigned NOT NULL DEFAULT '0', ADD COLUMN `member_id` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `channel_id`, ADD KEY (`member_id`);
// exp_ratings
ALTER TABLE `exp_ratings` CHANGE `weblog_id` `channel_id` int(4) unsigned NOT NULL DEFAULT '0', CHANGE `form_name` `collection` varchar(50) NOT NULL, CHANGE `rating_rev_r_y` `rating_helpful_y` int(10) NOT NULL DEFAULT '0', CHANGE `rating_rev_r_n` `rating_helpful_n` int(10) NOT NULL DEFAULT '0', DROP COLUMN `entry_title`, ADD KEY (`channel_id`), ADD KEY (`collection`), DROP KEY form_name;
// populate member_id
@rissajeanne
rissajeanne / disqus.php
Created January 19, 2012 00:50
disqus comments
Array
(
[76899] => Array
(
[level] => 0
[comment_id] => 4735
[disqus_id] => 76899
[disqus_parent_id] => 0
[root_id] => 0
[parent_id] => 0
@rissajeanne
rissajeanne / ABS.View.js
Created February 6, 2012 18:31
updateVersionDropdown
updateVersionDropdown : function() {
var languages = {},
sortedLangs = {};
this._versions.each(function(ver){
var lang = ver.get('lang');
if (!languages[lang]) {
languages[lang] = [];
}
languages[lang].push(ver);
@rissajeanne
rissajeanne / ABS.View.js
Created February 6, 2012 19:25
updateVersionDropdown
var languages = _.groupBy(_.sortBy(this._versions, function (v) {
return v.get('lang');
}), function (v) {
return v.get('lang');
});
console.log(languages);
updateVersionDropdown : function() {
var versionsByLang = {};
// Loop through the version model
_.each(
// Group versions by language,
// and sort the lang keys alphabetically.
_.groupBy(_.sortBy(this._versions.models, function (ver) {
return ver.get('lang');
}), function (ver) {
sortVersions: function() {
var getLang = function (ver) {
return ver.get('lang');
},
getLangAndAbbr = function (ver) {
return ver.get('lang') + ver.get('display_abbreviation');
};
this.sortedByLang = _.groupBy(this.sortBy(getLangAndAbbr), getLang);
}
ABS.Model.PassagePanel = Backbone.Model.extend({
initialize: function () {
this.updateBooks();
},
updateBooks: function () {
var that = this,
versions = new ABS.Collection.VersionList(ABS.bootstrap.versions),
getBookOrd = function (book) { return book.get('ord'); };