Skip to content

Instantly share code, notes, and snippets.

@dontangg
dontangg / FullGearList
Last active May 9, 2020 01:33
Make a bookmark with this as the URL. Go to the full gear list for a character on swgoh.gg and click the bookmark. (eg https://swgoh.gg/characters/supreme-leader-kylo-ren/gear-list/)
javascript:!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.download=t()}(this,function(){return function e(t,n,o){var a,i,r=window,d="application/octet-stream",s=o||d,c=t,l=!n&&!o&&c,u=document.createElement("a"),f=function(e){return String(e)},p=r.Blob||r.MozBlob||r.WebKitBlob||f,m=n||"download";if(p=p.call?p.bind(r):Blob,"true"===String(this)&&(s=(c=[c,s])[0],c=c[1]),l&&l.length<2048&&(m=l.split("/").pop().split("?")[0],u.href=l,-1!==u.href.indexOf(l))){var b=new XMLHttpRequest;return b.open("GET",l,!0),b.responseType="blob",b.onload=function(t){e(t.target.response,m,d)},setTimeout(function(){b.send()},0),b}if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(c)){if(!(c.length>2096103.424&&p!==f))return navigator.msSaveBlob?navigator.msSaveBlob(v(c),m):w(c);s=(c=v(c)).type||d}function v(e){for(var t=e.split(/[:;,]/),n=t[1],o=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),a=o.length,i=0,r=new Uint8Array(a);i<a;++i)r[i]=o.charCodeAt(i);return new p([r],{ty
@dontangg
dontangg / FullGearList unminified
Last active May 9, 2020 01:26
Make a bookmark with this as the URL. Go to the full gear list for a character on swgoh.gg and click the bookmark. (eg https://swgoh.gg/characters/supreme-leader-kylo-ren/gear-list/)
var csv = $('.media-list li.media').map((i, gearDiv) => {
var gearName = $(gearDiv).find('.media-heading h5').text();
var totalCount = parseInt($(gearDiv).find('.media-heading p').text().substring(1));
return gearName + ',' + totalCount;
}).toArray().join('\n');
csv = "Name,Total\n" + csv;
window.download(csv, "FullGearList.csv", "text/csv");
@dontangg
dontangg / GLGearNeeded unminified.js
Last active June 8, 2020 22:29
Unminified version of the gist
var csv = $('.gl-gear-needed__ingredient-header-primary').map((i, gearDiv) => {
var gearName = $(gearDiv).find('.gl-gear-needed__ingredient-header-name').text();
var gearRemainingText = $(gearDiv).find('.gl-gear-needed__progress').attr('title');
var matchResult = gearRemainingText.match(/(\d+) of (\d+)/);
var assignedCount = matchResult[1];
var totalCount = matchResult[2];
return gearName + ',' + totalCount + ',' + assignedCount;
}).toArray().join('\n');
csv = "Name,Total,Assigned,Hoarded\n" + csv;
window.download(csv, "GLGearNeeded.csv", "text/csv");
@dontangg
dontangg / GLGearNeeded.js
Last active March 26, 2020 19:21
Make a bookmark with this as the URL. Go to the gear needed page on swgoh.gg and click the bookmark.
javascript:;(function(root,factory){typeof define=="function"&&define.amd?define([],factory):typeof exports=="object"?module.exports=factory():root.download=factory()})(this,function(){return function download(data,strFileName,strMimeType){var self=window,defaultMime="application/octet-stream",mimeType=strMimeType||defaultMime,payload=data,url=!strFileName&&!strMimeType&&payload,anchor=document.createElement("a"),toString=function(a){return String(a)},myBlob=self.Blob||self.MozBlob||self.WebKitBlob||toString,fileName=strFileName||"download",blob,reader;myBlob=myBlob.call?myBlob.bind(self):Blob,String(this)==="true"&&(payload=[payload,mimeType],mimeType=payload[0],payload=payload[1]);if(url&&url.length<2048){fileName=url.split("/").pop().split("?")[0],anchor.href=url;if(anchor.href.indexOf(url)!==-1){var ajax=new XMLHttpRequest;return ajax.open("GET",url,!0),ajax.responseType="blob",ajax.onload=function(e){download(e.target.response,fileName,defaultMime)},setTimeout(function(){ajax.send()},0),ajax}}if(/^data:(
@dontangg
dontangg / CCDrawNode.cpp
Created March 10, 2016 06:49
Rounded rect for DrawNode in Cocos2d-x
void DrawNode::drawSolidRoundedRect(const Vec2 &origin, const Vec2 &destination, float radius, unsigned int segments, const Color4F &color)
{
const float coef = 2.0f * (float)M_PI/(segments - 8);
Vec2 *vertices = new (std::nothrow) Vec2[segments];
if( ! vertices )
return;
// Draw right edge
vertices[0].x = destination.x;
@dontangg
dontangg / TheX
Created November 7, 2015 20:51
A game for the TI-86
ClLCD
1→NEWX
1→NEWY
21→OX
8→OY
10→NEWSX1
8→NEWSY1
15→NEWSX2
2→NEWSY2
0→TIMER
@dontangg
dontangg / openssl-build.sh
Last active September 17, 2015 06:32 — forked from foozmeat/openssl-build.sh
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
#
# Original: https://gist.github.com/foozmeat/5154962
@dontangg
dontangg / directiveTest.html
Created December 15, 2014 23:56
Test directive for Envelopes
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js"></script>
<script>
var app = angular.module('myModule', []);
app.directive('leftPanel', function() {
return {
restrict: 'EA', //E = element, A = attribute, C = class, M = comment
@dontangg
dontangg / sudoku9.pl
Created July 30, 2012 19:37
Sudoku solver in prolog
valid([]).
valid([Head|Tail]) :- fd_all_different(Head), valid(Tail).
sudoku9(Puzzle, Solution) :-
Solution = Puzzle,
Puzzle = [S11, S12, S13, S14, S15, S16, S17, S18, S19,
S21, S22, S23, S24, S25, S26, S27, S28, S29,
S31, S32, S33, S34, S35, S36, S37, S38, S39,
S41, S42, S43, S44, S45, S46, S47, S48, S49,
@dontangg
dontangg / posh-git-profile.ps1
Last active October 3, 2015 08:08
My powershell setup
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current directory
Import-Module .\posh-git
# If module is installed in a default location ($env:PSModulePath),
# use this instead (see about_Modules for more information):
# Import-Module posh-git
function Write-Git-Branch {