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
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) {
@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);
@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 / 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
// 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
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',
@rissajeanne
rissajeanne / svnd
Created November 15, 2011 19:37
svn diff vim output script
#!/bin/bash
# Author: Marissa Hogue <[email protected]>
# 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"
// 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 / viewport.js
Created November 8, 2011 17:50
set viewport
// 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"]');
<?php
function i18nPOStrings() {
$locale = str_replace('-', '_', get_instance()->config->item('language_ui')->locale);
//$default = str_replace('-', '_', get_instance()->config->item('language_ui_default')->locale);
$dir = APPPATH . 'language/locale/' . $locale . '/LC_MESSAGES/';
$files = glob($dir . '*.po');
foreach ($files as $file) {
$contents .= file_get_contents($file) or die('Could not read from file.');