Skip to content

Instantly share code, notes, and snippets.

View qaisjp's full-sized avatar
🧪
why has the new github hidden statuses?

Qais Patankar qaisjp

🧪
why has the new github hidden statuses?
View GitHub Profile
@qaisjp
qaisjp / challenge.java
Last active August 29, 2015 13:55
A digital sum is the sum of all of the digits in a number so 214123 = 2+1+4+1+2+3 = 13 - The Tower of Hanoi puzzle involves moving disks in a certain order. What is digital sum of the number of required moves to solve 500000-disk Tower of Hanoi puzzle?
package demoproject;
import java.math.BigInteger;
public class blah {
public static void main(String[] args) {
BigInteger big = BigInteger.valueOf(2).pow(500000).subtract(BigInteger.ONE);
String[] num = big.toString().split("(?!^)");
int number = 0;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qaisjp
qaisjp / classlib.lua
Created April 23, 2014 01:40
MTA Libs: classlib
-- Developer: sbx320
-- License: MIT
-- Github Repos: https://github.com/sbx320/lua_utils
--// classlib
--|| @type: Shared
--|| @desc: A library providing several tools to enhance OOP with Lua
--|| @info: Registers itself into the global namespace
--\\
local elementClasses = {}
@qaisjp
qaisjp / emptyfiles.sh
Last active August 29, 2015 14:01
A little script that enumerates all files in the current folder recursively and does something to each file
# replaces the contents with "$FILENAME\n======" (representing a markdown header with the filename).
find . -type f -exec sh -c 'printf "$1 \n======" > "$1"' sh {} \;
# append extension ".md"
find . -type f -exec sh -c 'mv "$1" "$1.md"' sh {} \;
package main
import (
"io/ioutil"
"log"
"os"
"path"
"strings"
)
-- Developer: sbx320
-- License: MIT
-- Github Repos: https://github.com/sbx320/lua_utils
--// classlib
--|| A library providing several tools to enhance OOP with MTA and Lua
--\\
SERVER = triggerServerEvent == nil
CLIENT = not SERVER
DEBUG = DEBUG or false
@qaisjp
qaisjp / velo2.patch
Created November 22, 2014 16:51
mtasa-blue patch for oop velocities
Index: MTA10/mods/shared_logic/lua/CLuaMain.cpp
===================================================================
--- MTA10/mods/shared_logic/lua/CLuaMain.cpp (revision 6938)
+++ MTA10/mods/shared_logic/lua/CLuaMain.cpp (working copy)
@@ -163,7 +163,7 @@
lua_classfunction ( luaVM, "getPosition", CLuaOOPDefs::GetElementPosition );
lua_classfunction ( luaVM, "getRotation", CLuaOOPDefs::GetElementRotation );
lua_classfunction ( luaVM, "getMatrix", CLuaOOPDefs::GetElementMatrix );
- lua_classfunction ( luaVM, "getVelocity", "getElementVelocity" );
+ lua_classfunction ( luaVM, "getVelocity", CLuaOOPDefs::GetElementVelocity );
@qaisjp
qaisjp / edf.patch
Last active August 29, 2015 14:12
Patch for [editor]/editor_gui/client/elementproperties.lua and [editor]/edf/edf.lua
Index: edf/edf.lua
===================================================================
--- edf/edf.lua (revision 1024)
+++ edf/edf.lua (working copy)
@@ -408,7 +408,7 @@
for dataField, dataDefinition in pairs(elementDefinition.data) do
local checkedData = edfCheckElementData(theElement, dataField, dataDefinition)
if checkedData == nil then
- outputDebugString('Failed validation for ' .. elementType .. '!' .. dataField)
+ exports.editor_gui:outputMessage("Unable to create element; validation failed for "..elementType.."!"..dataField)
@qaisjp
qaisjp / uwot.patch
Last active August 29, 2015 14:13
radar area rectangle flash f11 map
Index: MTA10/mods/deathmatch/_Deathmatch 2008.vcproj
===================================================================
--- MTA10/mods/deathmatch/_Deathmatch 2008.vcproj (revision 7004)
+++ MTA10/mods/deathmatch/_Deathmatch 2008.vcproj (working copy)
@@ -1266,6 +1266,10 @@
RelativePath="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp"
>
</File>
+ <File
+ RelativePath="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp"
local sounds = {
"hello.mp3",
"2a.mp3",
"a.as.mp3",
"ahe.wav"
}
local currentNumber;
addCommandHandler("startPlaylist", function()