Skip to content

Instantly share code, notes, and snippets.

@olragon
olragon / run.sh
Last active January 3, 2017 00:37
HHVM config for Drupal 7 with clean urls working fine.
#!/usr/bin/env bash
sudo hhvm --config site1.hhvm.hdf --user www-data --mode daemon -v "Log.Level=Verbose" -v "Log.NoSilencer=on" -v "Log.Header=on"
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@bradleyboy
bradleyboy / nginx.conf
Last active March 22, 2022 19:46
nginx rewrite setup for Koken
# Enable gzip. Highly recommending for best peformance
gzip on;
gzip_comp_level 6;
gzip_types text/html text/css text/javascript application/json application/javascript application/x-javascript;
# By default, do not set expire headers
expires 0;
# Set expires header for console CSS and JS.
# These files are timestamped with each new release, so it is safe to cache them agressively.
@tomoyukiinoue
tomoyukiinoue / gist:4304007
Created December 16, 2012 07:27
Install Python and Django for Mac OS X 10.8
# Install Python 2.7.3 via Homebrew
$ brew install python
$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile
$ python --version
Python 2.7.3
# Install Django 1.4.3 by easy_install
$ sudo easy_install django
$ sudo easy_install virtualenv
@mnewt
mnewt / proxy-toggle.sh
Created September 13, 2012 20:00
trivial command to toggle Mac OS X SOCKS proxy
#!/bin/sh
PROXY_INTERFACE="USB Ethernet"
PROXY_HOST=localhost
PROXY_PORT=1080
if [[ $1 == "on" ]]; then
sudo networksetup -setsocksfirewallproxy "$PROXY_INTERFACE" $PROXY_HOST $PROXY_PORT
echo "SOCKS proxy enabled"
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
@mystix
mystix / setup-php-dev.sh
Last active April 27, 2023 15:46
(OSX 10.7.x/10.8.x + Homebrew + nginx + mysql + php 5.4 + php-fpm + apc + xdebug) development environment
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
@abersager
abersager / index.html
Created March 29, 2012 22:36
Using cookies and nginx web server configuration to conditionally serve high resolution images
<!doctype html>
<!--
Using cookies and nginx web server configuration to conditionally serve
high resolution images to <img> tags
-->
<html>
<head>
<!-- set device-pixel-ratio cookie using JavaScript -->
<script type="text/javascript" charset="utf-8">
@mrconnerton
mrconnerton / node_field_collection_save.php
Created March 13, 2012 21:28
How to programtically save a node with field collections
<?php
// Lets just pretend your content type is "Event" with machine name "event"
$node = new stdClass();
$node->type = 'event';
node_object_prepare($node);
$node->title = "My event title";
$node->language = LANGUAGE_NONE;
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",