View gist:e4b412ac3fd01dadb455
func getProfilesByPoints(completionHandler: (users:NSMutableArray) -> ()) {
var users = NSMutableArray()
var query = PFQuery(className:"points")
query.addDescendingOrder("points")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {
View codesearch.py
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 = ::Azure::Armrest::VirtualMachineService.new(vm.provider_object)
vmm.start(vm.name, group)
rescue => err
_log.error "vm=[#{vm.name}], error: #{err}"
end
def vm_stop(vm, _options = {})
group = vm.uid_ems.split('\\').first
View post-checkout
#!/bin/bash
#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
<?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 verify_android_push_notification_token.php
function verify_notification_token($token) {
$fields = array(
'dry_run' => true,
'to' => $token,
);
$headers = array(
'Authorization: key=' . GOOGLE_API_SERVER_KEY,
'Content-Type: application/json',
);
$ch = curl_init();
View gist:6b195eac71217cd6d428
/**
*
*/
$(window).on('message', function(e) {
var data = e.originalEvent.data;
if (data.method !== 'createIFrame') return;
var proxyUrl = chrome.runtime.getURL('/src/iframeProxy/proxy.html');
View gitfix.sh
EDITOR=`git config --get --global core.editor`
alias gitfix="$EDITOR `git diff --name-status --diff-filter=U | awk 'NF>1{printf \"%s \", \$NF}'`"
View requirejs config
require.config({
baseUrl: '/javascript',
paths: {
// Vendor Files
'select2': '../vendor/select2-dist/dist/js/select2.min',
'json2': '../vendor/json2/json2',
'tinyMCE': '../vendor/tinymce-dist/jquery.tinymce.min',
'lightbox': '../vendor/lightbox2/js/lightbox.min',
'animateColors': '../vendor/color-animation/jquery.animate-colors-min',
'videoJs': '../vendor/video.js/dist/video-js/video',
View The Technical Interview Cheat Sheet.md

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.