Skip to content

Instantly share code, notes, and snippets.

@brutalhonesty
brutalhonesty / amiiboRegexp.js
Last active Aug 29, 2015
Amiibo regular expression
View amiiboRegexp.js
// Regexp
var amiiboRegexp = new RegExp(/([M|m]ario(s)?|[P|p]each(s)?|[Y|y]oshi(s)?|[D|d]onkey(?:\s)?[K|k]ong(s)?|[L|l]ink(s)?|[F|f]ox(?:es|s)?|[S|s]amus(?:es|s)?|(?:[W|w]ii(?:\s)?[F|f]it(?:\s)?)?[T|t]rainer(s)?|[V|v]illager(s)?|[P|p]ikachu(s)?|[K|k]irb(?:y|ies|s)|[M|m]arth(es|s)?|[D|d]iddy(?:\s)?[K|k]ong(es|s)?|[Z|z]elda(es|s)?|[L|l]uigi(es|s)?|[L|l]ittle(?:\s)?[M|m]ac(s)?|[C|c]aptain(?:\s)?[F|f]alcon(s)?|[P|p]it(es|s)?|[R|r]osalina(es|s)?|[B|b]owser(es|s)?|[L|l]ucario(s)?|[T|t]oon(?:\s)?[L|l]ink(s)?|[S|s]h(?:ei|ie)k(s)?|(?:[K|k]ing\s)?(?:[D|d]edede(s)?|[D|d]ee(?:\s)?[D|d]ee)|[D|d]3(s)?|[K|k]3[D|d](s)?|[I|i]ke(s)?|[S|s]hulk(s)?|[S|s]onic(s)?|[M|m]ega(?:\s)?[M|m][a|e]n|[M|m]eta(?:\s)?(?:[K|k])?night(s)?|[R|r]obin(s)?|[L|l]ucina(s)?|[C|c]harizard(s)?|[P|p]ac((?:\s)?|(-)?)[M|m]an(s)?|[W|w]ario(s)?|[N|n]ess(es)?)/g);
// Test data
var titles = ['marth amiibo empty box (figure not included)',
'amiibo toon link',
'rosalina lucario sheik toon link amiibo super rare wave 3 free shipping nib',
'amiibo trinity (marth,
@brutalhonesty
brutalhonesty / wave4.json
Created Jan 14, 2015
Amiibo Wave 4 Nintendo Product Codes
View wave4.json
{
"robin": {
"productCode": {
"na": "NVL-C-AABU-USZ",
"eu": "NVL-C-AABU-EUR-CO"
}
},
"lucina": {
"productCode": {
"na": "NVL-C-AABT-USZ",
@brutalhonesty
brutalhonesty / languages.js
Created Dec 24, 2014
List of every language available on Github
View languages.js
var yaml = require('yamljs');
var request = require('request');
function _getLanguages(callback) {
request.get('https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml', function (error, resp, body) {
if(error) {
return callback(error);
}
if(resp.statusCode !== 200) {
return callback(body);
@brutalhonesty
brutalhonesty / list.js
Last active Aug 29, 2015
Top "false-positive" mispelled words in top 40 public Github repos for 2014 based on "best matched" results using "After the Deadline" API spellchecker
View list.js
[ [ 'gists', 16 ],
[ 'uiscrollview', 16 ],
[ 'repl', 17 ],
[ 'firefox', 17 ],
[ 'anijs', 17 ],
[ 'ios', 18 ],
[ 'sshrc', 18 ],
[ 'hail2u', 18 ],
[ 'jhgg', 19 ],
[ 'makefile', 19 ],
@brutalhonesty
brutalhonesty / amiibos.json
Last active Aug 29, 2015
Amiibo JSON Object for retailers.
View amiibos.json
{
"mario": {
"productCode": {
"na": "NVL-C-AAAA-USZ",
"eu": "NVL-C-AAAA-EUR-CO"
},
"ean": {
"na": "045496891657",
"eu": "0045496352363",
"jp": "4902370522259"
@brutalhonesty
brutalhonesty / workflow.js
Last active Aug 29, 2015
Client-Server Workflow for OAuth.io Node SDK
View workflow.js
// Client-side
$scope.openGooglePopover = function() {
Userservice.getStateToken().success(function (resp) {
OAuth.popup('google', {
state: resp.token
}).done(function (data) {
var userData = {
code: data.code
};
@brutalhonesty
brutalhonesty / keybaseLogin.js
Created Oct 27, 2014
Keybase.io Login w/NodeJS using Request, Crypto, and Scrypt
View keybaseLogin.js
// Get salt: https://keybase.io/docs/api/1.0/call/getsalt
// Login: https://keybase.io/docs/api/1.0/call/login
var request = require('request');
var scrypt = require('scrypt');
var crypto = require('crypto');
var username = "myUsername";
var password = "myPassword";
request('https://keybase.io/_/api/1.0/getsalt.json?email_or_username=' + username, function (error, body, results) {
if(error) {
console.log(error);
View keybase.md

Keybase proof

I hereby claim:

  • I am brutalhonesty on github.
  • I am brutalhonesty (https://keybase.io/brutalhonesty) on keybase.
  • I have a public key whose fingerprint is 1EE0 AFF2 29DD 0485 CCB3 E456 2A3C 4FAC 130A AD8C

To claim this, I am signing this object:

@brutalhonesty
brutalhonesty / apiIssue.js
Created Jul 14, 2014
Google Place API Issue Update
View apiIssue.js
// From http://code.google.com/p/gmaps-api-issues/issues/detail?id=5991
// Call back for the request made to Google
// Results is the list of results in JSON
// Status is whether or not the request came back OK or some other error
// Pagination is if there are other pages available
function callback(results, status, pagination) {
var place = [];
var moreButton = false;
//If the Google query came back OK
@brutalhonesty
brutalhonesty / controller.js
Last active Aug 29, 2015
AngularJS Material Input Field Issue
View controller.js
angular.module('myApp').controller('MyCtrl', ['$scope', 'MyService', function ($scope, MyService) {
// On partial load, this service call fires $http.get() for user data.
MyService.getProfile().success(function (profileResp) {
$scope.firstName = profileResp.firstName;
$scope.lastName = profileResp.lastName;
$scope.username = profileResp.username;
}).error(function (error) {
// Do something with error.
});
$scope.editProfile = function() {