Skip to content

Instantly share code, notes, and snippets.

View ngocphamm's full-sized avatar

Ngoc Pham ngocphamm

View GitHub Profile
@alexandrevicenzi
alexandrevicenzi / HttpClientExtensions.cs
Created February 25, 2014 20:11
C# Post, Put and Patch as JSON async extensions
using System;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading.Tasks;
namespace MyProject.Extensions
{
public static class HttpClientEx
{
public const string MimeJson = "application/json";
@ahmozkya
ahmozkya / README.md
Last active July 7, 2023 09:27
Homebrew with DNSMasq + DNSCrypt-proxy (OpenDNS)
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

#!/bin/bash
# Add Vagrant's NFS setup commands to sudoers, for `vagrant up` without a password
# Updated to work with Vagrant 1.3.x
# Stage updated sudoers in a temporary file for syntax checking
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
@supermarin
supermarin / dash_emoji_snippets.sql
Last active January 30, 2020 19:58
Emoji in realtime with Dash.app Thanks @orta for putting this up. Read below for importing instructions
INSERT INTO 'snippets' ('title', 'body') VALUES
(':+1:', '👍'),
(':-1:', '👎'),
(':100:', '💯'),
(':1234:', '🔢'),
(':8ball:', '🎱'),
(':a:', '🅰'),
(':ab:', '🆎'),
(':abc:', '🔤'),
(':abcd:', '🔡'),
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@sindresorhus
sindresorhus / git-dirty-checks.md
Created October 16, 2012 11:20
Benchmark results of the fastest way to check if a git branch is dirty

Tested against the WebKit git repo by entering the repo with 1 file dirty.


git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec

@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