Skip to content

Instantly share code, notes, and snippets.

-- test/main.hs:(12,1)-(16,2): Splicing declarations
instance Database.Persist.Class.PersistField.PersistField Person where
Database.Persist.Class.PersistField.toPersistValue
= \ ent_ac87
-> (Database.Persist.Types.Base.PersistMap
GHC.Base.$
(GHC.List.zip
(GHC.Base.map Data.Text.pack ["age"])
((GHC.Base.map Database.Persist.Class.PersistField.toPersistValue)
GHC.Base.$
@MaxGabriel
MaxGabriel / gist:766f5490d9985b07dd91
Created August 24, 2015 00:08
stack test output
Max@maximilians-mbp ~/D/C/y/yesod-scaffold> stack test
PROJECTNAME-0.0.0: configure (test)
Configuring PROJECTNAME-0.0.0...
PROJECTNAME-0.0.0: build (test)
Preprocessing library PROJECTNAME-0.0.0...
[1 of 9] Compiling Model ( Model.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Model.o )
[2 of 9] Compiling Settings ( Settings.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Settings.o )
[3 of 9] Compiling Settings.StaticFiles ( Settings/StaticFiles.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Settings/StaticFiles.o )
[4 of 9] Compiling Import.NoFoundation ( Import/NoFoundation.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Import/NoFoundation.o )
[5 of 9] Compiling Foundation ( Foundation.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Foundation.o )
BOOL hz_chartboost_enabled(void) {
return [HeyzapAds isNetworkInitialized:HZNetworkChartboost];
}
void hz_fetch_chartboost_for_location(const char *location) {
NSString *nsLocation = [NSString stringWithUTF8String:location];
if (!hz_chartboost_enabled()) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
hz_fetch_chartboost_for_location(location);
@MaxGabriel
MaxGabriel / CacheSizeInfo.m
Created June 1, 2015 23:49
CacheSizeInfo reporting
//
// CacheSizeInfo.m
// Heyzap
//
// Created by Maximilian Tagher on 4/13/15.
// Copyright (c) 2015 Heyzap. All rights reserved.
//
#import "CacheSizeInfo.h"
@MaxGabriel
MaxGabriel / CacheSizeInfo.m
Last active September 24, 2015 18:09
Gist to check the amount of cache used
//
// CacheSizeInfo.m
// Heyzap
//
// Created by Maximilian Tagher on 4/13/15.
// Licensed to the public domain https://creativecommons.org/publicdomain/zero/1.0/
//
#import "CacheSizeInfo.h"
@MaxGabriel
MaxGabriel / HeyzapUnitySDK.mm
Created May 13, 2015 15:30
Unity adapter code for iOS
//
// HeyzapUnitySDK.m
//
// Copyright 2014 Smart Balloon, Inc. All Rights Reserved
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
@MaxGabriel
MaxGabriel / HZBannerAd.h
Created May 13, 2015 15:29
HZBannerAd.h
//
// HZBannerAdWrapper.h
// Heyzap
//
// Created by Maximilian Tagher on 3/6/15.
// Copyright (c) 2015 Heyzap. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@MaxGabriel
MaxGabriel / mediation
Created May 6, 2015 01:43
Suspending dispatch queues
// In initialization, creating a serial queue targeted at the main queue.
// This causes blocks to submitted to `pausableMainQueue` to run on the main queue.
// If the `pausableMainQueue` is suspended, then new blocks submitted to it won't be started
// (The currently running block, if any, will continue running)
self.pausableMainQueue = dispatch_queue_create("com.heyzap.sdk.mediation.pausable_main", DISPATCH_QUEUE_SERIAL);
dispatch_set_target_queue(self.pausableMainQueue, dispatch_get_main_queue());
- (void)pauseExpensiveWork {
if (!self.pausableQueueIsPaused) {
self.pausableQueueIsPaused = YES;
@MaxGabriel
MaxGabriel / splitTest.hs
Created March 29, 2015 15:39
script using a conduit-based split function
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (unless)
import qualified Data.Text as T
import Data.Conduit
import qualified Data.Conduit.Combinators as CC
import Control.Monad.Trans.Resource
import qualified Data.Conduit.List as CL
@MaxGabriel
MaxGabriel / Parsing.hs
Created March 16, 2015 17:39
log parsing wip
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE QuasiQuotes #-}
module LogParsing.Parsing where
import Data.Attoparsec.Text
import ClassyPrelude
import Data.IP (IPv4, toIPv4)