Skip to content

Instantly share code, notes, and snippets.

@ryancole
ryancole / README.md
Created May 10, 2012 15:29 — forked from TooTallNate/README.md
'cflags' parameter is broken in gyp on OS X?

This is a barebones GYP file to compile 1 C source file. We are demonstrating that the cflags parameter in gyp files gets completely ignored :(

$ ../gyp/gyp -f make --depth=. hello.gyp
$ V=1 make
  cc   -fasm-blocks -mpascal-strings -Os -gdwarf-2  -MMD -MF out/Default/.deps/out/Default/obj.target/hello/hello.o.d.raw  -c -o out/Default/obj.target/hello/hello.o hello.c
  ./gyp-mac-tool flock out/Default/linker.lock g++ -Lout/Default   -o "out/Default/hello" out/Default/obj.target/hello/hello.o 
  LINK(target) out/Default/hello: Finished
Option Explicit
Sub CreateMultipleFiles()
ActiveSheet.Cells.Select
ActiveSheet.Cells.Replace "Filtered", ""
End Sub
' Format each worksheet
#include <stdio.h>
#include <Windows.h>
#include "Utilities.h"
#include "MemoryManager.h"
namespace Aspects_Managers {
MemoryManager::MemoryManager() {
Global $active
; set hotkeys
HotKeySet("q", "SendKeys")
HotKeySet("w", "ToggleActive")
; start script
InfiniteLoop()
@ryancole
ryancole / foo.m
Created August 7, 2012 01:06
Convert NSPredicate into NSDictionary for use as a query string in an AFNetworking HTTP request
- (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]]) {
@ryancole
ryancole / TitleField.h
Created August 14, 2012 02:27
A subclass of `UITextField` that has a prefixed label.
//
// TitleField.h
// mustached-bear
//
// Created by Ryan Cole on 8/12/12.
// Copyright (c) 2012 Ryan Cole. All rights reserved.
//
#import <UIKit/UIKit.h>
#include <node.h>
#include <v8.h>
#ifndef UNIX
#define UNIX
#define UNIX_64
#endif
#include <scctype.h>
#include <sccex.h>
@ryancole
ryancole / foreign_key_count.sql
Created January 9, 2013 17:58
Query for records with more than X number of foreign key matches.
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)
@ryancole
ryancole / foo.sql
Last active December 11, 2015 20:59
get a count of items for each user, accounting for duplicates and nulls / empties
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
(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"})))))