View sample-section-in-menu.php
function theme_slug_customize_register( $wp_customize ) {
$wp_customize->add_section( 'sample_section',
'title' => 'Sample Section',
'panel' => 'nav_menus',
def binary(a, needle):
if len(a)==0 or needle < a[0] or needle > a[len(a)-1]: return -1
mid = len(a)/2
if a[mid] > needle: return binary(a[:mid], needle)
if a[mid] < needle: return mid + binary(a[mid:], needle)
return mid
#by megan o'keefe
#created: July 31st, 2015
#last modified: 7/31/2015
#has WordsApi definitions, also working on: wikipedia articles.
import json
import unirest
import wikipedia
View Build Errors
The following errors were automatically identified, please review the full console logs for details:
OS X Errors
Generating moc_ErrorDialog.cpp
CompileC build/libraries/ui/ libraries/ui/src/ErrorDialog.cpp normal x86_64 c++
/Applications/ -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-c
View gist:e4b412ac3fd01dadb455
func getProfilesByPoints(completionHandler: (users:NSMutableArray) -> ()) {
var users = NSMutableArray()
var query = PFQuery(className:"points")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {
import asyncio
import aiohttp
import urllib
import json
import tqdm
import math
import sys
import ssl
from urllib import request
from urllib import parse
View ems_azure.rb
def vm_start(vm, _options = {})
group = vm.uid_ems.split('\\').first
vmm =
vmm.start(, group)
rescue => err
_log.error "vm=[#{}], error: #{err}"
def vm_stop(vm, _options = {})
group = vm.uid_ems.split('\\').first
View post-checkout
#Git Post Merge Hook
#Gets the latest tag info from the git repo and updates the AssemblyInfo.cs file with it.
#This file needs to be place in the .git/hooks/ folder and only works when a git pull is
#made which contains changes in the remote repo.
#get the latest tag info. The 'always' flag will give you a shortened SHA1 if no tag exists.
tag=$(git describe --long)
View check-default-lang.php
function prefered_language( $available_languages, $http_accept_language = 'auto' ) {
if ( 'auto' == $http_accept_language ) {
// $http_accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$http_accept_language = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
preg_match_all( '/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?' . '(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i', $http_accept_language, $hits, PREG_SET_ORDER );
$bestlang = $available_languages[0];
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.