This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async -> | |
my_result = some_large_calculation() | |
other_result = {} | |
await bukkit_sync (-> | |
other_result.value = do_something_on_api(my_result) | |
), defer() | |
do_database_save other_result.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MaxOwnedBy = (owner) -> | |
rankNumber = -> | |
return 3 if SpecialUsers::IsVip owner | |
return 2 if SpecialUsers::IsVeteran owner | |
return 1 | |
permsNumber = -> | |
Permissions::getPlayer(owner).getInfo("js.extraplots", 0, Bukkit.server.getWorld plot_world).integer | |
return rankNumber() + permsNumber() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreativePlots | |
plot_size = 80 | |
road_size = 5 | |
plot_world = 'creative' | |
plot_ownerships = JsPersistence.tryGet 'creative_plots', {} | |
plot_height = 20 | |
all_builds = registerHash 'all_builds' | |
@Ownerships = plot_ownerships |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class @WorldEdit | |
class JTypes | |
@classLoader = "WorldEdit".plugin.class.classLoader | |
@bukkitWorld = @classLoader.loadClass "com.sk89q.worldedit.bukkit.BukkitWorld" | |
@vector = @classLoader.loadClass "com.sk89q.worldedit.Vector" | |
@cube = @classLoader.loadClass "com.sk89q.worldedit.regions.CuboidRegion" | |
@singleBlock = @classLoader.loadClass "com.sk89q.worldedit.patterns.SingleBlockPattern" | |
@baseBlock = @classLoader.loadClass "com.sk89q.worldedit.blocks.BaseBlock" | |
@localWorld = @classLoader.loadClass "com.sk89q.worldedit.LocalWorld" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function registerCommand(data, func) { | |
var commandExecClass = plugin["class"].classLoader.loadClass("net.connorcpu.plugjs.JsCommandExecutor"); | |
var newCommand = function() { | |
var commandClass = plugin["class"].classLoader.loadClass("net.connorcpu.plugjs.JsCommand"); | |
var commandEx = (function(__func__) { | |
var state = { func: __func__, permTest: function(p){return true;} }; | |
var object = { | |
execute: function(sender, label, args) { | |
if (!this.getState().permTest(sender)) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Want to run code async? | |
blah 'bah' | |
await async defer() | |
#everything after this line is on the new thread | |
some_func 'which takes a long time' | |
#want to get back on the main thread? | |
my_results = finish_dat_long_func() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function registerCommand(data, func) { | |
var commandExecClass = plugin["class"].classLoader.loadClass("net.connorcpu.plugjs.JsCommandExecutor"); | |
var newCommand = function() { | |
var commandClass = plugin["class"].classLoader.loadClass("net.connorcpu.plugjs.JsCommand"); | |
var commandEx = (function(__func__) { | |
var state = { func: __func__, permTest: function(p){return true;} }; | |
var object = { | |
execute: function(sender, label, args) { | |
if (!this.getState().permTest(sender)) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (Entity entity : world.getEntities()) { | |
if (entity instanceof Item) { | |
entity.remove(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using Windows.UI; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Documents; | |
using Windows.UI.Xaml.Media; | |
using Cloudsdale_Metro.Helpers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult UpdatePrefix(ChangePrefixModel model) { | |
if (!Request.IsAuthenticated) return RedirectToAction("Login", "Account"); | |
var referer = Request.UrlReferrer ?? new Uri("/"); | |
if (User.Identity.Name != model.User && !CmcsRoleProvider.IsStaff(User.Identity.Name)) { | |
return Redirect(referer.ToString()); | |
} | |
if (!ModelState.IsValid) |
OlderNewer