Skip to content

Instantly share code, notes, and snippets.

View firasuke's full-sized avatar
🎐
لَا بُدَّ مِنْ رِيحٍ تُبَدِّدُ اَلْغُيُومْ...

Firas Khalil Khana firasuke

🎐
لَا بُدَّ مِنْ رِيحٍ تُبَدِّدُ اَلْغُيُومْ...
View GitHub Profile
@Rabios
Rabios / Native.hx
Last active June 11, 2021 21:50
rabios.github.io's Gists load place!
package pancake;
import haxe.Constraints.Function;
/**
* ...
* @author Rabia Haffar
*/
@:native("window.navigator.app")
extern class NavigatorApp {
@Rabios
Rabios / arr2obj.js
Created February 19, 2021 12:03
JavaScript function that converts array to object
function arr2obj(array) {
var result = {};
for (var i = 0; i < array.length; i++) {
result[(i).toString()] = array[i];
}
return result;
}
@Rabios
Rabios / sizeof.js
Last active June 11, 2021 21:51
Returns size (length) of any type if possible
function sizeof(o) {
if (typeof(o) == "object") {
if (o.length !== void 0) {
return o.length;
} else {
var i = 0;
for (var k in o) i++;
return i;
}
} else if (typeof(o) == "string") {
@Rabios
Rabios / copy_array.js
Last active June 11, 2021 21:51
Array consists of copies of other array's elements
function copy_array(a, t) {
var result = [];
if (t == 0 || t == 1) {
result = a;
} else {
for (var i = 0; i <= t - 1; i++) {
for (var j = 0; j < a.length; j++) result.push(a[j]);
}
}
return result;
@Rabios
Rabios / drgtk-lumines_block_rotation.rb
Created November 27, 2020 03:50
Lumines block rotation in DRGTK
# Written by Rabia Alhaffar in 27/November/2020
# OpenLumines 1st test: Block rotation
# This demonstrates a Lumines block and it's rotatable with up arrow key.
=begin
Supporters:
@kniknoo
@LeviDuncanPixel
@Hiro_r_b
=end
def tick args
@Rabios
Rabios / pyramid.lua
Created September 27, 2020 17:32
Pyramid array creation example
-- Written by Rabia Alhaffar in August/2020
local function pyramid(n)
local result = nil
if (n > 0) then
result = {}
for i = 1, n, 1 do
result[i] = {}
for j = 1, i, 1 do
result[i][j] = 1
end
@Rabios
Rabios / even_or_odd.lua
Created September 27, 2020 17:26
Even or Odd example
-- Written by Rabia Alhaffar in 27/September/2020
-- Even or Odd example
local function even(a)
if ((a % 2) == 0) then
return true
else
return false
end
end
@Rabios
Rabios / numtable.lua
Last active June 11, 2021 21:51
Simple way to get biggest and smallest number from table in Lua
-- Written by Rabia Alhaffar in 26/September/2020
-- Simple way to get biggest and smallest number from table in Lua
local function bignum(t)
local _ = -math.huge
for i in ipairs(t) do
if (t[i] >= _) then
_ = t[i]
end
end
return _
@Rabios
Rabios / rectangle.java
Created August 10, 2020 20:18
Extending for raylib rectangle class for java bindings,Place it before main void
public static class Rectangle extends Raylib.Rectangle {
public Rectangle() {
super();
}
public Rectangle(float x, float y, float width, float height) {
x(x);
y(y);
width(width);
height(height);
}
@Rabios
Rabios / sys.lua
Last active April 29, 2022 12:04
Detect some operating systems and CPU architecture via Lua
-- Written by Rabia Alhaffar in June 14, 2021
-- Simple script to detect some operating systems and CPU architecture via Lua! ;)
-- Updated: June 14, 2021
-- Also, I would thank NickWilde263 and Nameless on GitHub for their suggestions! <3
-- https://github.com/NickWilde263
-- https://github.com/truemedian
local sys = {
arch = "UNKNOWN",