Skip to content

Instantly share code, notes, and snippets.

@graywolf336
graywolf336 / controllers.go
Created June 26, 2020 20:48
Returning multiple values from a single function
package controllers
func getAccountUserAndWorkspaceFromToken(token, workspaceID string) (*models.Account, *models.User, *models.Workspace, error) {
client := core.GetClient()
userID := ""
accountID := ""
if len(token) > 0 {
user, err := client.Utils().ValidateUserJWTToken(token)
@graywolf336
graywolf336 / costOfLivingCalc.html
Created August 14, 2018 20:15
Simple calculator which takes the cost of living, or how much you want to make, and tells you how much you should make an hour/day.
<!DOCTYPE html>
<html>
<head>
<title>Simple Cost of Living Calc</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.questions {
display: flex;
flex-direction: column;
import { IRequest, IResponse, RequestMethod, ResponseStatus } from './interfaces/Webhook';
import { ISetting } from './interfaces/ISetting';
import { priority, PriorityValue } from './decorators/priority';
import { IMessage } from './interfaces/IMessage';
import { IUser } from './interfaces/IUser';
import { IRoom } from './interfaces/IRoom';
export class BaseRocketlet {
/**
* Create a new Rocketlet, this is called whenever the server starts up and initiates the Rocketlets. Note, your implementation of this class should call `super(name, id, version)` so we have it.
@graywolf336
graywolf336 / keybase.md
Last active January 3, 2017 20:53
keybase.md

Keybase proof

I hereby claim:

  • I am graywolf336 on github.
  • I am graywolf336 (https://keybase.io/graywolf336) on keybase.
  • I have a public key whose fingerprint is 779F A2B4 52C9 ED68 B159 AC06 0666 B2C2 4C43 C358

To claim this, I am signing this object:

import React, { Component } from 'react-native';
import MapView from 'react-native-maps';
const {
StyleSheet,
Text,
View,
Dimensions,
TouchableOpacity,
} = React;
@graywolf336
graywolf336 / example.js
Created July 8, 2015 19:39
Rate Limiter w/ Async
var limiter = new RateLimiter(5, 15000);
async.each([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], function(i, callback) {
limiter.removeTokens(1, function(err, remainingRequests) {
if(err) {
callback(err);
}else {
console.log(i);
callback();
}
@graywolf336
graywolf336 / screenHeight
Created June 20, 2015 14:57
screenHeight Directive - Changes the height of an element to the screen size
app.directive('screenHeight', ['$window', '$log', function($window, $log) {
return {
restrict: 'A',
link: function($scope, element, attrs) {
var changeHeight = function() {
$log.log('Setting the height of', element, 'to', $window.innerHeight);
element.css('height', $window.innerHeight + 'px');
}
changeHeight();
@graywolf336
graywolf336 / abc.txt
Last active August 29, 2015 13:57 — forked from markrendle/abc.txt
1. Back up C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\schemas\html\commonHTML5Types.xsd
2. Delete C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\schemas\html\commonHTML5Types.bin if it exists
3. Replace it with the file below.
4. Restart Visual Studio 2012.
@graywolf336
graywolf336 / BukkitSerialization.java
Last active April 30, 2024 02:00
Serialize and deserialize the player's inventory, including armor and content.
/**
* Converts the player inventory to a String array of Base64 strings. First string is the content and second string is the armor.
*
* @param playerInventory to turn into an array of strings.
* @return Array of strings: [ main content, armor content ]
* @throws IllegalStateException
*/
public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException {
//get the main content part, this doesn't return the armor
String content = toBase64(playerInventory);
@graywolf336
graywolf336 / config.yml
Last active December 30, 2015 12:29
Jail 3.0 Default Config
# ###################
# Jail v3.0.0-SNAPSHOT-b206 config file
# Note: You -must- use spaces instead of tabs!
# ###################
system:
configVersion: 3
debug: false
language: en
updateNotifications: true
useBukkitTimer: true