Skip to content

Instantly share code, notes, and snippets.

<?php
$config = simplexml_load_string('<config><prepare /></config>');
$configArray = (array)$config;
var_dump((bool)$config->prepare); // true
var_dump((bool)$configArray['prepare']); // false
<?php
class Test {
protected $_data = array();
public function __call($method, $args) {
if (substr($method, 0, 3) == 'set') {
$key = strtolower(substr($method, 3));
if (isset($args[0])) {
<?php
$element = simplexml_load_string(<<<EOF
<root>
<hello>world</hello>
</root>
EOF
);
echo $element->children()[0] . "\n";
diff --git hphp/util/embedded_data.cpp hphp/util/embedded_data.cpp
index 6b16dc9..a7da200 100644
--- hphp/util/embedded_data.cpp
+++ hphp/util/embedded_data.cpp
@@ -78,7 +78,7 @@ bool get_embedded_data(const char *section, embedded_data* desc) {
#else // __APPLE__
const struct section_64 *sect = getsectbyname("__text", section);
if (sect) {
- string path = current_executable();
+ std::string path = current_executable_path();
require 'formula'
class Jemallocfb < Formula
homepage 'http://www.canonware.com/jemalloc/download.html'
url 'http://www.canonware.com/download/jemalloc/jemalloc-3.4.0.tar.bz2'
sha1 '06f572f1cc6a4e4a68c7f9a354f12e17ba32f70b'
keg_only "We're just a patched version."
# __GLIBC__ is not defined, but we still want hooks!
@danslo
danslo / systemlib_executable.patch
Created July 15, 2013 12:58
work around lack of /proc/self/exe
diff --git hphp/util/embedded_data.cpp hphp/util/embedded_data.cpp
index a0bdeb0..98f8dca 100644
--- hphp/util/embedded_data.cpp
+++ hphp/util/embedded_data.cpp
@@ -29,6 +29,8 @@
#ifdef __APPLE__
#include <mach-o/getsect.h>
+#include <mach-o/dyld.h>
+#include <limits.h>
diff --git app/code/local/Danslo/CheckoutDesign/Model/Observer.php app/code/local/Danslo/CheckoutDesign/Model/Observer.php
new file mode 100644
index 0000000..1512dab
--- /dev/null
+++ app/code/local/Danslo/CheckoutDesign/Model/Observer.php
@@ -0,0 +1,29 @@
+<?php
+
+class Danslo_CheckoutDesign_Model_Observer
+{
diff --git hphp/hhvm/CMakeLists.txt hphp/hhvm/CMakeLists.txt
index 775d168..acedec5 100644
--- hphp/hhvm/CMakeLists.txt
+++ hphp/hhvm/CMakeLists.txt
@@ -3,6 +3,7 @@ auto_sources(files "*.cpp" "")
list(APPEND CXX_SOURCES ${files})
add_executable(hhvm ${CXX_SOURCES})
+if (NOT APPLE)
target_link_libraries(hhvm hphp_analysis hphp_runtime_static ext_hhvm_static hphp_system
@danslo
danslo / boostfb.rb
Last active December 19, 2015 02:18
require 'formula'
class UniversalPython < Requirement
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
Boost compiles against the Python it finds in the path; if this Python
is not a universal build then linking will likely fail.
diff --git hphp/runtime/base/thread_init_fini.cpp hphp/runtime/base/thread_init_fini.cpp
index 6826c69..a84b63b 100644
--- hphp/runtime/base/thread_init_fini.cpp
+++ hphp/runtime/base/thread_init_fini.cpp
@@ -63,7 +63,9 @@ void init_thread_locals(void *arg /* = NULL */) {
g_context.getCheck();
AsioSession::Init();
s_hasRenamedFunction.getCheck();
+#ifndef NO_HARDWARE_COUNTERS
HardwareCounter::s_counter.getCheck();