This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibonacci (n) { | |
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); | |
}; | |
var fibonacci_memo = (function () { | |
var memo = [0,1]; | |
function fib (n) { | |
var result = memo[n]; | |
if (typeof result !== 'number') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stack () { | |
var content = []; | |
return { | |
push: function (v) { | |
content[content.length] = v; | |
}, | |
pop: function () { | |
var result = content.splice(-1, 1); | |
if (result.length === 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get all items in this frame split into regions | |
function getRegionItems (items) { | |
var result = []; | |
items.forEach(function (item) { | |
var x = Math.floor(item.pos.x / 28); | |
var y = Math.floor(item.pos.y / 28); | |
var region = (x * 4) + y; | |
if (result[region] === undefined) { | |
result[region] = [item]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup> | |
<Content Include="App.config"> | |
<SubType>Designer</SubType> | |
</Content> | |
<Content Include="App.Base.config"> | |
<DependentUpon>App.config</DependentUpon> | |
</Content> | |
<Content Include="App.Debug.config"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn append-user-data [handler] | |
(fn [request] | |
(clutch/with-db database-address | |
(let [access-token (get-in request [:headers "token"]) | |
view-data (clutch/get-view "api" "users-by-token" {:keys [access-token]})] | |
(if (= 1 (count view-data)) | |
(handler (assoc request :api-user (:value (first view-data)))) | |
{:status 403 | |
:body "Invalid access token"}))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT v.custodian_id, COUNT(DISTINCT NVL(LOWER(TRIM(v.serial_numberev)), v.evidence_id)) AS esi_count | |
FROM evidence_to_custodian e | |
LEFT OUTER JOIN evidence_main v ON v.evidence_id = e.evidence_id | |
WHERE v.purged != 1 AND LOWER(v.source) = 'ac' AND v.inventory_class = 1 AND LOWER(v.source_mediaev) = 'hdd' AND e.custodian_id IN (:custodians) | |
GROUP BY v.custodian_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.emplid | |
FROM term_file t | |
WHERE t.emplid IN (SELECT v.custodian_id FROM evidence_main v GROUP BY v.custodian_id HAVING COUNT(v.custodian_id) > 50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <node.h> | |
#include <v8.h> | |
#ifndef UNIX | |
#define UNIX | |
#define UNIX_64 | |
#endif | |
#include <scctype.h> | |
#include <sccex.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TitleField.h | |
// mustached-bear | |
// | |
// Created by Ryan Cole on 8/12/12. | |
// Copyright (c) 2012 Ryan Cole. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSURLRequest *)requestForFetchRequest:(NSFetchRequest *)fetchRequest | |
withContext:(NSManagedObjectContext *)context { | |
// init the query string dictionary | |
NSMutableDictionary *queryString = nil; | |
// if we're given a predicate, convert it to a dictionary | |
if (fetchRequest.predicate) { | |
if ([fetchRequest.predicate isKindOfClass:[NSCompoundPredicate class]]) { |