Skip to content

Instantly share code, notes, and snippets.

View CodeOfficer's full-sized avatar

Russell Jones CodeOfficer

View GitHub Profile
@CodeOfficer
CodeOfficer / Game-parse.js
Last active March 6, 2020 17:39
Parse PS4 game data
// vist https://store.playstation.com/en-us/home/games
// look at localstorage
// copy your entitlements data and substitue for GAME_DATA below
const games = GAME_DATA;
const sortedGames = games.sort(function(a, b) {
var textA = a.game_meta.name.toUpperCase();
var textB = b.game_meta.name.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
@CodeOfficer
CodeOfficer / dad-jokes.js
Last active August 12, 2018 18:19
Dad Jokes
const dadJokes = {
random() {
return this.jokes[Math.floor(Math.random() * this.jokes.length)];
},
jokes: [
"Did you hear about the restaurant on the moon? Great food, no atmosphere.",
"What do you call a fake noodle? An impasta.",
"How many apples grow on a tree? All of them.",
"Want to hear a joke about paper? Nevermind, it's tearable.",
"I just watched a documentary about beavers. It was the best dam show I've ever seen.",

Keybase proof

I hereby claim:

  • I am codeofficer on github.
  • I am codeofficer (https://keybase.io/codeofficer) on keybase.
  • I have a public key whose fingerprint is E210 A1C5 3588 530F 8660 B063 F260 F399 D9C9 3D38

To claim this, I am signing this object:

{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_minimap_border": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
// A fix for the ember chrome extension so that we can peek into the data store
// see https://github.com/stefanpenner/ember-app-kit/issues/263#issuecomment-28482992
/* global require */
export default DS.DebugAdapter.reopen({
getModelTypes: function() {
var self = this;
return Ember.keys(requirejs._eak_seen).filter(function(key) {
return !!key.match(/^appkit\/models\//) && self.detect(require(key)['default']);
sessionInvalidationSucceeded: function() {
this.transitionTo(Ember.SimpleAuth.routeAfterInvalidation);
// unload all store data on logout
var store = this.container.lookup('store:main');
var typeMaps = store.get('typeMaps');
Ember.keys(typeMaps).forEach(function(type) {
var key = typeMaps[type].type;
store.unloadAll(key);
@CodeOfficer
CodeOfficer / validators.js
Created January 17, 2013 16:02
Validators for ember-data
var get = Ember.get;
DS.Model.reopen({
validate: function() {
if (get(this, 'isDeleted')) {
return;
}
get(this, 'validators').forEach(function(validator) {
validator.fn.call(this, validator.meta.key(this.constructor), get(this, validator.attribute), validator.options);
}, this);
var get = Ember.get;
DS.Model.reopen({
validate: function() {
if (get(this, 'isDeleted')) {
return;
}
get(this, 'validators').forEach(function(validator) {
validator.fn.call(this, validator.meta.key(this.constructor), get(this, validator.attribute), validator.options);
}, this);
@CodeOfficer
CodeOfficer / gist:4264600
Created December 12, 2012 03:19
mocha ember
require 'tests/support/test_helper'
describe "Ember Application", ->
application = null
beforeEach (done) ->
Ember.$("body").append "<div id='app'></div>"
Ember.run ->
application = Em.Application.create(rootElement: "#app", autoinit: false)