Skip to content

Instantly share code, notes, and snippets.

@Mizpah
Mizpah / schema.rb
Created February 24, 2013 00:42
Am working on an application that will play the role of a guild website, alongside the multiple systems that a guild needs. (mmo and other gaming communities). This has come about of the back of crating multiple website/system for this purpose that have to be scrapped whenever we change game, and getting tired of people needing good guild websit…
encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@Mizpah
Mizpah / game_classes_controller.rb
Created February 24, 2013 02:33
I have a page with around 60 objects. Using Kaminari to create pagination. The first page example is the existing page. Everything in one table, and the columns have a sort link in the header. Th recipie for this was taken from a tutorial and adapted. I note that line '4' was explained as being 'critical to stop things breaking'. The second exam…
def index
@game_classes = GameClass.order("game_id").page(params[:page]).per(15)
@game_classes = GameClass.order(params[:sort]).page(params[:page]).per(15) if params[:sort]
#@game_classes = @game_classes.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @game_classes }
end
end
@Mizpah
Mizpah / _game_class.html.erb
Created February 25, 2013 00:12
The list game_classes page used to work, with sortable tables. It used a partial for the table body (header was in the index). Added pagination, better sortable tables, and a search field via several railscasts. I started to add ajaxification to all of the elements. Each intended change worked, so I am unsure where I introduced the error. Now th…
<table class="pretty">
<thead>
<tr>
<th><%= sortable "name" %></th>
<th>Description</th>
<th><%= sortable "game_id" %></th>
<th></th>
<th></th>
<th></th>
</tr>
@Mizpah
Mizpah / application.js
Created February 25, 2013 18:34
Here what I started with (application.js / index.js.erb), and the subsequent attempts. I also tried an entirely new game_classes_coffee.js. note the railscast version of the file (application.js) reads: ).live("click", -- have changed this to on mylsef.
$(function() {
$("#game_classes th a, #game_classes .pagination a").on("click", function() {
$.getScript(this.href);
return false;
});
$("#game_classes_search input").keyup(function() {
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, "script");
return false;
});
});
@Mizpah
Mizpah / _game_classes.html.erb
Created February 25, 2013 23:31
Initially built with scaffold, edit and show links were working. After working extensively on index (ajaz, paging, sorting, search fielkds, partials), I have discovered they are no longer working! For example the show.html.erb gives me: undefined method `name' for nil:NilClass when executing <%= @game_class.name % However, the show method is def…
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<table class="pretty">
<thead>
<tr>
<th><%= sortable "name" %></th>
<th>Description</th>
<th><%= sortable "game_id" %></th>
<th></th>
<th></th>
@Mizpah
Mizpah / gist:5069033
Created March 2, 2013 00:31
Running: rake assets:precompile rake aborted! undefined method `[]' for nil:NilClass The below output shows sequence from passing tests through to error. I have also tried to tun a local precom,pile (google tip, and then output that with a trace)
Finished in 0.59557 seconds
13 examples, 0 failures, 2 pending
<-- Slave(2) run done!
Martin@BALOO /g/Aptana Studio 3 Workspace/mmofish (master)
$ git push heroku master
Enter passphrase for key '/c/Users/Martin/.ssh/id_rsa':
Counting objects: 44, done.
@Mizpah
Mizpah / gemfile
Created March 2, 2013 01:13
gemfile
# mmofish gemfile -- DO NOT MODIFY without speaking to Mizpah!
source 'https://rubygems.org'
# We have chose to use a pessamistic versioning constraint (~>2.1) during development
# in some cases, amd latest versions (optimistic constraint) (=>2.1) in others.
# This iwll be reviewed for production
gem 'rails', '~>3.2'
# Bundle edge Rails instead (initiate for testing only):
@Mizpah
Mizpah / new_seeds.rb
Created March 5, 2013 12:08
Trying to work out the syntax of a seeds.rb file for a rake:dbseed command. I have a reference - the first file -- however in my example I do not have an entity 'name' in my db, I have the entity 'username'. Clearly I am not identifying correctly that the user is both the reference to the column, and an object - So after several attempts I guess…
puts 'DEFAULT USERS'
user = User.find_or_create_by_email :username => ENV['ADMIN_NAME'].dup, :email => ENV['ADMIN_EMAIL'].dup,
:password => ENV['ADMIN_PASSWORD'].dup, :password_confirmation => ENV['ADMIN_PASSWORD'].dup
puts 'username: ' << user.username
user.add_role :admin
@Mizpah
Mizpah / application.html.erb
Created March 6, 2013 05:04
I am trying to dynamically change the output of <%= render 'layouts/header %> called from application.html.erb, based on the controller. I have just created a namespaced admin controller, accessible under /admin The controller is Admin::DashboardController. Based on inheritance, I have to place my alternate version of the partial _header.html.er…
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media:" all" %>
<%= javascript_include_tag "application" %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "mmofish" %>">
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
@Mizpah
Mizpah / error1_debug_output.txt
Last active August 29, 2015 14:01
A detailed breakdown of the two alternate errors using Feeds & Feeds Xpath Parser to import XML nodes. Please see readme.txt for details.
Wildstar Item Import 51 has been created.
context :
<N K="tItemDb" T="t"> <N F="37671" T="t"> <N K="tItemInfo" T="t"> <N K="nPowerLevel" T="n" V="48"/> <N K="sIcon" T="s" V="IconSprites:Icon_ItemArmor_Heavy_Armor_Shoulders_01"/> <N K="nItemPower" T="n" V="1434"/> <N K="tPrimary" T="t"> <N K="strName" T="s" V="Mutagen Shoulder Plates"/> <N K="eCategory" T="n" V="3"/> <N K="tLevelRequirement" T="t"> <N K="nLevelRequired" T="n" V="48"/> <N K="bRequirementMet" T="b" V="-"/> </N> <N K="nId" T="n" V="37671"/> <N K="bDestroyOnLogout" T="b" V="-"/> <N K="tCost" T="t"> <N K="nBuyCost" T="n" V="78384"/> <N K="nSellValue" T="n" V="15676"/> </N> <N K="tDurability" T="t"> <N K="nMax" T="n" V="71"/> </N> <N K="eType" T="n" V="18"/> <N K="tStack" T="t"> <N K="nMaxCount" T="n" V="1"/> </N> <N K="arInnateProperties" T="t"> <N F="1" T="t"> <N K="nSortOrder" T="n" V="3"/> <N K="eProperty" T="n" V="42"/> <N K="nValue" T="n" V="1496"/> </N> </N> <N K="tProfRequirement" T="t"> <N K="nId" T="n" V="2"/> <N K="bRequirementMet" T="b"