Skip to content

Instantly share code, notes, and snippets.

View ifarbod's full-sized avatar
🙃
I'm a jack of all trades

iFarbod ifarbod

🙃
I'm a jack of all trades
View GitHub Profile
@ybakos
ybakos / GraphicGlDemoActivity.java
Created November 27, 2012 00:52
A simple example of using an Android Renderer to illustrate OpenGL ES boilerplate.
/* GraphicGlDemoActivity.java
* Author: Yong Bakos
* Since: 11/26/2012
* Thanks to:
* Cube: http://intransitione.com/blog/create-a-spinning-cube-with-opengl-es-and-android/
* OpenGL Boilerplate: http://www.jayway.com/2009/12/03/opengl-es-tutorial-for-android-part-i/
*/
package com.humanoriented.sudoku;
import java.nio.ByteBuffer;
@ifarbod
ifarbod / a_spec.pwn
Created July 6, 2014 15:16
SetPlayerSpectatePlayer Function.
// We need some fuctions.
#include <a_samp>
// Declaring a var for checking a player is spectating which player.
new
gSpecTarget[MAX_PLAYERS] = INVALID_PLAYER_ID;
// An enum. For storing player pos (x, y, z)
enum E_PLAYER_POS
{
@webmonch
webmonch / gist:14d3daeffff6593c65d3
Last active August 13, 2019 13:36
2dimArr rapidjson
rapidjson::Document jsonDoc;
rapidjson::Document::AllocatorType& allocator = jsonDoc.GetAllocator();
jsonDoc.SetObject();
rapidjson::Value mainArr(rapidjson::kArrayType);
for (int i = 0; i < 6; ++i) {
rapidjson::Value row(rapidjson::kArrayType);
@ifarbod
ifarbod / loopstest.pwn
Created September 3, 2014 17:18
A Small snippet for testing two ways of loops
#include <a_samp>
#define ITERS (10000000)
main()
{
new
ticks = GetTickCount();
for(new i = 0; i < ITERS; i++)
{
@Tairy
Tairy / sb.cpp
Created March 31, 2015 11:22
sb
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include <iostream>
#include "rapidjson/filereadstream.h"
#include <cstdio>
using namespace rapidjson;
int main(){
FILE* fp = fopen("factory.json", "rb");
@ocornut
ocornut / (Archived) imgui_memory_editor.h
Last active January 1, 2024 04:27
Mini memory editor for dear imgui (to embed in your game/tools)
// Mini memory editor for Dear ImGui (to embed in your game/tools)
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112
// THE MEMORY EDITOR CODE HAS MOVED TO GIT:
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor
// Click "Revisions" on the Gist to see old version.
@yurydelendik
yurydelendik / !wasmllvm.md
Last active May 31, 2024 06:31
Using WebAssembly in LLVM

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@ryancford
ryancford / TrimMemory.java
Created December 3, 2015 01:06
Log calls to onTrimMemory().
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
String levelString = "TRIM_MEMORY_RUNNING_MODERATE";
switch (level) {
case TRIM_MEMORY_RUNNING_MODERATE: levelString = "TRIM_MEMORY_RUNNING_MODERATE"; break;
case TRIM_MEMORY_RUNNING_LOW: levelString = "TRIM_MEMORY_RUNNING_LOW"; break;
case TRIM_MEMORY_RUNNING_CRITICAL: levelString = "TRIM_MEMORY_RUNNING_CRITICAL"; break;
@fclairamb
fclairamb / rapidjson_gen_json.cpp
Created January 5, 2016 13:04
Write some JSON using a rapidjson library
#ifdef SHELL
g++ -Wall -Werror -g -I../../cclib/rapidjson/include $0 && ./a.out
exit 0
#endif
// Output is:
// {"project":"rapidjson","stars":11}
// {"Name":"XYZ","Rollnumer":2,"array":["hello","world"],"Marks":{"Math":"50","Science":"70","English":"50","Social Science":"70"}}
// {"FromEmail":"sender@gmail.com","FromName":"Sender's name","Subject":"My subject","Recipients":[{"Email":"recipient@gmail.com"}],"Text-part":"this is my text"}
<?php
$doc = file_get_contents('http://opensource.spotify.com/cefbuilds/index.html');
$pattern = '/href="cef_binary_[0-9].[0-9]+.[0-9]+.[a-zA-Z0-9]+_windows32_minimal.tar.bz2"/';
$cefpath = 'http://opensource.spotify.com/cefbuilds/';
preg_match($pattern, $doc, $matches);
$cefbuildnum = $matches[0];
$cefbz = substr($cefbuildnum, 6, strlen($cefbuildnum) - 7);