Skip to content

Instantly share code, notes, and snippets.

View sclark39's full-sized avatar

Skyler Clark sclark39

View GitHub Profile
@sclark39
sclark39 / user.lua
Last active August 29, 2015 14:00
My ZeroBrane Config
--[[--
Use this file to specify User preferences.
Review [examples](+C:\Users\Sky\Desktop\ZeroBrane-0.39\cfg\user-sample.lua) or check [online documentation](http://studio.zerobrane.com/documentation.html) for details.
--]]--
editor.tabwidth = 4
editor.usetabs = true
editor.nomousezoom = true
-- allow auto-complete of user words
@sclark39
sclark39 / Elixer_Utility.lua
Last active August 29, 2015 14:00
NS2 Modding Utility function
Script.Load( "lua/Class.lua" )
function DPrint( string )
//Shared.Message( string )
end
function Class_AddMethod( className, methodName, method )
if _G[className][methodName] and _G[className][methodName] ~= method then
return
end
@sclark39
sclark39 / LockConstants.lua
Created October 23, 2014 18:36
Lock Constants
function LockConstants()
local ks = {}
for k,v in pairs( _G ) do
if k:sub( 1, 1 ) == 'k' then
ks[k] = v
_G[k] = nil
end
end
setmetatable( _G, {
@sclark39
sclark39 / class.lua
Last active August 29, 2015 14:08
Lua class lib with 'base' helper method
-- test.lua
-- using the class lib and the introspective base helper method
class 'A'
function A:test()
print "Hi"
end
class 'B' (A)
function B:test()
@sclark39
sclark39 / AWSAPIGatewayClientExtension.swift
Last active February 19, 2017 18:17
Simple extension to AWSAPIGatewayClient rewritten for Swift 3 to automatically get configuration, and have a shared lazy instantiated client. Other code will call invokeHTTPRequest directly.
/*
Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License is located at
http://aws.amazon.com/apache2.0
or in the "license" file accompanying this file. This file is distributed
@sclark39
sclark39 / Utility.swift
Created February 21, 2017 17:18
What's in a name?
class Utility
{
public class func _________( ___ ____: String ) -> Decimal?
{
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = Locale(identifier: "en_US")
if let number = formatter.number(from:____)
{
/*
Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License is located at
http://aws.amazon.com/apache2.0
or in the "license" file accompanying this file. This file is distributed
/*
Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License is located at
http://aws.amazon.com/apache2.0
or in the "license" file accompanying this file. This file is distributed
private func makeRequest(
method : String, url : String,
query : [String:Any]! = nil,
body : [String:Any]! = nil,
complete: @escaping DatabaseAsyncCallback
)
{
let client = WOMAPIGatewayClient.default()
// Define the routes, which we will procedurally load
const routes =
{
get: // body data not allowed in GET
[
{ path: '/', action: 'HelloWorld' },
{ path: '/http', action: 'TestHTTP' },
{ path: '/echo', action: 'EchoRequest' },
]
}