Skip to content

Instantly share code, notes, and snippets.

View melchoy's full-sized avatar
👩‍💻

Melissa Choy melchoy

👩‍💻
View GitHub Profile
:: 1) Download srvany.exe from Microsoft Windows 2003 Resource Kit (available free from Microsoft).
:: 2) Copy srvany.exe into the folder where google drive is installed or next to this script file.
:: 3) Run this script as an Administrator
echo off
cls
SET STARTING_DIR=%CD%
SET SCRIPT_DIR=%~dp0
module ActiveAdminHelper
def admin_arbre_context
@admin_arbre_context ||= Arbre::Context.new(assigns, self)
end
def default_renderer
case controller.send(:resource_class).name
when "ActiveAdmin::Page"
"page"
http {
# Declare index at http level
index index.html index.php;
server {
# Set IP & Port For Server Block
listen 00.000.000.000:80;
# Set Server Name
server_name www.example.com;
# Redirect WWW to non WWW (http://wiki.nginx.org/Pitfalls)
@melchoy
melchoy / gist:4062681
Created November 12, 2012 23:08
WordPress get post data via ajax with json
<?php
// Make ajax requests to /wp-admin/admin-ajax.php?action=get_post&id=127
add_action('wp_ajax_get_post', 'figgis_get_post_json');
add_action('wp_ajax_nopriv_get_post', 'figgis_get_post_json');
function get_post_json() {
header('Cache-Control: no-cache, must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
@melchoy
melchoy / install_php_ngninx.sh
Created October 23, 2012 02:29 — forked from gagarine/install_php_ngninx.sh
Drupal on php-fpm + nginx + apc
brew update
brew install gmp
#install Nginx
brew install nginx
# copy launch script
cp /usr/local/Cellar/nginx/1.0.12/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
#try to launch Nginx
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
@melchoy
melchoy / gist:3878831
Created October 12, 2012 11:44 — forked from superp/gist:888384
Publish stream in Facebook & Twitter with OmniAuth
# models/person.rb
serialize :auth_hash, Hash
def facebook
@fb_user ||= FbGraph::User.me(user_attributes[:token])
end
def twitter
@tw_user ||= prepare_access_token(user_attributes[:token], user_attributes[:secret])
end
@melchoy
melchoy / ruby-class.js
Created June 1, 2012 13:26 — forked from michealbenedict/ruby-class.js
Ruby-style classes in ECMAScript 5
var Class = Object.create(null, {
"new": {
"value": function () {
var result = Object.create(this, {
"class": {
"value": this
}
});
result.initialize.apply(result, arguments);
return result;
@melchoy
melchoy / README.markdown
Created June 1, 2012 05:33 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@melchoy
melchoy / config.ru
Created May 22, 2012 11:04 — forked from brookr/config.ru
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson ([email protected])
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@melchoy
melchoy / powssl
Created May 7, 2012 00:27 — forked from paulnicholson/powssl
ssl with pow using stud

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://raw.github.com/gist/2050941/3ea59efe8c7e9013c265313045a9fdda5c653963/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl