Skip to content

Instantly share code, notes, and snippets.

View rambkk's full-sized avatar
👻
looking for impossible task

rambkk

👻
looking for impossible task
View GitHub Profile
@cadebrown
cadebrown / mg.c
Last active October 6, 2021 03:10
mg (my-grep), an open-source, single-file implementation of regex & grep-like functionality from scratch
/* mg.c - my-grep implementation, portable regex and search implementation in pure C
*
* should build on UNIX/Linux-like OSes no problem, should also work on Windows Subsystem for Linux (WSL)
*
* regex syntax: read the second comment block in this file
*
* compile like:
* $ cc mg.c -o mg
*
* then you can run like:
@rambkk
rambkk / PHP-array_reduce,findIndex,findIndexes.php
Last active April 9, 2024 11:41
PHP array_reduce, findIndex, and findIndexes functions
<?php
/*
* PHP array_reduce_key (v0.11) - array_reduce with additional parameters
* array_reduce with key,
* (javascript like reduce method)
* (if initial value of carry is not specified, null is used)
*
* PHP array_reduce_JS (v0.12) - array_reduce with additional parameters
* (javascript like reduce method)
* if initial value of carry is not specified, first item of input ARRAY is used, and CALLBACK starts on the second item
@cam-gists
cam-gists / js2phpobj.js
Created September 8, 2012 05:10
JavaScript / PHP: JSON Object to PHP Object
/**
* Converts a JS object to PHP object
**/
function jsObj2phpObj(object){
var json = '{';
for(property in object){
var value = object[property];
if(typeof(value) == 'string'){
json += '"' + property + '":"' + value + '",'
} else {