Skip to content

Instantly share code, notes, and snippets.

View marcioAlmada's full-sized avatar
🚀

Márcio Almada marcioAlmada

🚀
View GitHub Profile
<?php
namespace igorw\lusp;
// all functions return a pair of [val, env]
function evaluate($expr, $env = []) {
if (is_string($expr)) {
if (is_numeric($expr)) {
$val = (float) $expr;
@jprante
jprante / harvard-marc21-to-elasticsearch.md
Last active August 23, 2022 09:47
Ingest Harvard Library Bibliographic Dataset into Elasticsearch (as raw unmapped MARC21 fields)

HOWTO

Ingest Harvard Library Bibliographic Dataset into Elasticsearch (as raw unmapped MARC21 fields)

This HOWTO is for Linux systems (Windows is very similar)

  • install Java 8 into /usr/java/jdk1.8.0
  • install Elasticsearch 1.1.0
@huglester
huglester / phpbrew_debian7
Last active August 29, 2015 13:57
phpbrew Debian 7.0 setup
# I installed phpbrew 1.3.0 since has problems with instlaing extentions using 1.3.1
# see https://github.com/c9s/phpbrew/issues/214
curl -O https://raw.github.com/c9s/phpbrew/master/phpbrew
chmod +x phpbrew
sudo cp phpbrew /usr/bin/phpbrew
phpbrew init
source ~/.phpbrew/bashrc
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Applicative ((<*))
import qualified Data.Set as S
import Prelude hiding (exp)
import Text.Parsec
@krakjoe
krakjoe / arrayof-perf.md
Last active September 11, 2020 17:05
arrayof-perf.md

Arrayof Performance

<?php
function arrayof_foo(Foo[] $fooze) {
    foreach ($fooze as $foo) {
    	$foo->bar();
    }
}
@nikic
nikic / php_evaluation_order.md
Last active October 19, 2021 05:47
Analysis of some weird evaluation order in PHP

Order of evaluation in PHP

Yesterday I found some people on my [favorite reddit][lolphp] wonder about the output of the following code:

<?php

$a = 1;
$c = $a + $a++;
@dwilkins
dwilkins / 20-intel.conf
Last active December 22, 2015 11:18
X11 Config file for Fedora 19 (et. al.) that keeps the graphics card from going into thermal meltdown
# file: /etc/X11/xorg.conf.d/20-intel.conf
# source: https://wiki.archlinux.org/index.php/Intel_Graphics#Choose_acceleration_method
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "uxa"
EndSection
@krakjoe
krakjoe / pthreads.md
Last active August 30, 2023 18:30
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@nikic
nikic / bench.php
Last active November 2, 2023 22:49
Benchmark of call_user_func_array vs switch optimization vs argument unpacking syntax
<?php error_reporting(E_ALL);
function test() {}
$nIter = 1000000;
$argNums = [0, 1, 2, 3, 4, 5, 100];
$func = 'test';
foreach ($argNums as $argNum) {
@emre
emre / golang_binary_search.go
Last active October 13, 2020 23:10
binary search implementation on golang slices
package main
import (
"fmt"
)
func BinarySearch(target_map []int, value int) int {
start_index := 0
end_index := len(target_map) - 1