Skip to content

Instantly share code, notes, and snippets.

View SabreCat's full-sized avatar

Sabe Jones SabreCat

  • HabitRPG
  • Madison, WI
View GitHub Profile
@SabreCat
SabreCat / gist:792fc924e6dd0b6f0e7a7f1be8da5c4a
Last active March 22, 2023 15:01
Block useless Twitter crap in uBlock Origin
twitter.com##article:has(a:has-text(/liked|replied|follow/i))
twitter.com##article:has(a:has-text(/liked|replied|follow/i)):xpath(../..) + div
twitter.com##article:has(a:has-text(/liked|replied|follow/i)):xpath(../..) + div + div
twitter.com##div > div > div > div > div > div > div > div > div > div:has-text(/You might like|Trends for you|Who to follow/)
twitter.com##div [role="heading"]:has-text(/Who to follow/):xpath(..)
twitter.com##div [role="heading"]:has-text(/Who to follow/):xpath(../../..) + div
twitter.com##div [role="heading"]:has-text(/Who to follow/):xpath(../../..) + div + div
twitter.com##div [role="heading"]:has-text(/Who to follow/):xpath(../../..) + div + div + div
twitter.com##div [role="heading"]:has-text(/Who to follow/):xpath(../../..) + div + div + div + div
@SabreCat
SabreCat / analyticsServices.js
Last active August 29, 2015 14:23
Analytics service with $inject
/**
* Created by Sabe on 6/15/2015.
*/
'use strict';
angular
.module('habitrpg')
.factory('Analytics', analyticsFactory);
analyticsFactory.$inject = [
@SabreCat
SabreCat / analyticsServicesSpec.js
Last active August 29, 2015 14:22
Analytics service TDD WIP
/**
* Created by Sabe on 6/11/2015.
*/
'use strict';
describe('Analytics Service', function () {
var analytics;
var onScriptLoad;
beforeEach(function() {
@SabreCat
SabreCat / inventory.jade
Created December 25, 2014 20:24
Shop layout WIP
script(type='text/ng-template', id='partials/options.inventory.seasonalshop.html')
.container-fluid
.stable.row
.col-md-2
.seasonalshop_winter2015
.col-md-10
.popover.static-popover.fade.right.in
.arrow
h3.popover-title!=env.t('seasonalShopTitle', {linkStart:"<a href='http://blog.habitrpg.com/who' target='_blank'>", linkEnd: "</a>"})
.popover-content
@SabreCat
SabreCat / index.coffee
Created December 25, 2014 18:56
Purchasing
purchase: (req, cb, ga) ->
{type,key} = req.params
if type is 'gems' and key is 'gem'
{convRate, convCap} = api.planGemLimits
convCap += user.purchased.plan.consecutive.gemCapExtra
return cb?({code:401,message:"Must subscribe to purchase gems with GP"},req) unless user.purchased?.plan?.customerId
return cb?({code:401,message:"Not enough Gold"}) unless user.stats.gp >= convRate
return cb?({code:401,message:"You've reached the Gold=>Gem conversion cap (#{convCap}) for this month. We have this to prevent abuse / farming. The cap will reset within the first three days of next month."}) if user.purchased.plan.gemsBought >= convCap
user.balance += .25
@SabreCat
SabreCat / gist:18d8c8cd42a0a861ff99
Created December 24, 2014 22:23
Seasonal shop WIP
script(type='text/ng-template', id='partials/options.inventory.seasonalshop.html')
.container-fluid
.stable.row
.col-md-2
.seasonalshop_winter2015
.col-md-10
.popover.static-popover.fade.right.in
.arrow
h3.popover-title!=env.t('seasonalShopTitle', {linkStart:"<a href='http://blog.habitrpg.com/who' target='_blank'>", linkEnd: "</a>"})
.popover-content
@SabreCat
SabreCat / automaticAllocation
Created December 26, 2013 14:54
HabitRPG's logic for automatic assignment of an attribute point at levelup
if user.preferences.automaticAllocation
tallies = _.reduce user.tasks, ((m,v)-> m[v.attribute or 'str'] += v.value;m), {str:0,int:0,con:0,per:0}
suggested = _.reduce tallies, ((m,v,k)-> if v>tallies[m] then k else m), 'str'
user.stats[suggested]++
@SabreCat
SabreCat / RandomPrefs
Last active December 20, 2015 15:09
Resource for maybe randomizing new users
genders = ['f','m']
hairs = ['blond','black','brown','white']
skins = ['dead','orc','asian','black','white']
genders[Math.floor(Math.random()*(genders.length))]
hairs[Math.floor(Math.random()*(hairs.length))]
skins[Math.floor(Math.random()*(skins.length))]