Skip to content

Instantly share code, notes, and snippets.

@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@riley-van-hengstum
riley-van-hengstum / DoctrineProxyHandler.php
Last active September 19, 2021 15:04
Disable lazy loading when serializing Doctrine 2 objects with JMS Serializer
namespace MyApp\ApiBundle\Serializer;
use JMS\Serializer\Context;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\VisitorInterface;
use JMS\Serializer\XmlSerializationVisitor;
class DoctrineProxyHandler implements SubscribingHandlerInterface
{
diff -r 7af530381fec src/eval.c
--- a/src/eval.c Sun Aug 17 17:24:07 2014 +0200
+++ b/src/eval.c Mon Aug 18 16:39:16 2014 +0900
@@ -6899,8 +6899,8 @@
free_unref_items(copyID)
int copyID;
{
- dict_T *dd;
- list_T *ll;
+ dict_T *dd, *dd_next;
@codeinthehole
codeinthehole / docker-osx-shared-folders.rst
Last active November 11, 2023 01:22
How to share folders with docker containers on OSX

How to share a folder with a docker container on OSX

Mounting shared folders between OSX and the docker container is tricky due to the intermediate boot2docker VM. You can't use the usual docker -v option as the docker server knows nothing about the OSX filesystem - it can only mount folders from the boot2docker filesystem. Fortunately, you can work around this using SSHFS.

@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@BlakeGardner
BlakeGardner / Install HTTPie.md
Last active November 5, 2020 08:43
Install HTTPie Mac OS X

This is a quick guide on installing HTTPie for Mac OS X systems. This is also useful if you want the python package management utility pip. An installed copy of Homebrew is a prerequisite.

HTTPie

The easy way

brew install httpie
@faisalman
faisalman / example.js
Last active June 4, 2020 12:02
7-bit GSM 03.38 <-> Unicode Map in JS
// Unicode to 7-bit GSM
var write = "Hello, Faisalman!";
var msgSubmit = "";
write.split('').forEach(function(i) {
msgSubmit += parseInt(Unicode2GSM[i], 10).toString(16).toUpperCase() + " ";
});
console.log(msgSubmit); // "48 65 6C 6C 6F 2C 20 46 61 69 73 61 6C 6D 61 6E 21 "
// 7-bit GSM to Unicode
var read = "48 65 6C 6C 6F 2C 20 46 61 69 73 61 6C 6D 61 6E 21 ";
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@cameronhunter
cameronhunter / responsive-abbreviations.html
Created October 2, 2012 12:31
Responsive abbreviations in HTML using CSS
<!doctype html>
<html>
<head>
<title>Responsive Abbreviations</title>
<style type="text/css">
/* Show "U.K." */
abbr {cursor:default; border:none;}
/* Show "United Kingdom" */
@media (min-width: 481px) {
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark