This file contains 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
withImgurDirectoryListing conf logger f = do | |
#ifdef PRODUCTION | |
s <- static Settings.staticDir | |
#else | |
s <- staticDevel Settings.staticDir | |
#endif | |
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf) | |
$ either error return . Database.Persist.Base.loadConfig | |
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do | |
Database.Persist.Base.runPool dbconf (runMigration migrateAll) p |
This file contains 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
import XMonad | |
import qualified XMonad.StackSet as W | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.DynamicLog hiding (xmobar) | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Util.Run(spawnPipe) | |
import XMonad.Util.EZConfig(additionalKeys) | |
import XMonad.Actions.CycleWS | |
import XMonad.Layout.NoBorders | |
import XMonad.Actions.UpdateFocus |
This file contains 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
-- | Merges the simple 'DSInfo's based on function calls from the functions | |
analyzeFunctions :: [DSFun t] -> [DSInfo] | |
analyzeFunctions dsfs = let startingDSF = lookupDSF dsfs startingFunction in | |
let functions = map getDSFFun dsfs in | |
let startingVars = map snd $ concatMap getDSINames $ getDSFDSI startingDSF in | |
let runMain = mapMaybe (\var -> analyzeFunction functions startingDSF var []) startingVars in --update the accumulator | |
concatMap (uncurry (:)) runMain where | |
analyzeFunction :: [FunctionDeclaration t] -> DSFun t1 -> VariableName -> [FunctionName] -> Maybe (DSInfo, [DSInfo]) | |
analyzeFunction functions dsf variable accumulator = let functionName = getFunName.getDSFFun $ dsf in | |
toMaybe (functionName `notElem` accumulator) (let functionCalls = getDSFCalls dsf in |
This file contains 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
-- | Merges the simple 'DSInfo's based on function calls from the functions | |
analyzeFunctions :: [DSFun t] -> [DSInfo] | |
analyzeFunctions dsfs = let startingDSF = lookupDSF dsfs startingFunction in | |
let functions = map getDSFFun dsfs in | |
let startingVars = map snd $ concatMap getDSINames $ getDSFDSI startingDSF in | |
let runMain = mapMaybe (\var -> analyzeFunction functions startingDSF var []) startingVars in --update the accumulator | |
concatMap (uncurry (:)) runMain where | |
analyzeFunction :: [FunctionDeclaration t] -> DSFun t1 -> VariableName -> [FunctionName] -> Maybe (DSInfo, [DSInfo]) | |
analyzeFunctiog functions dsf variable accumulator = let functionName = getFunName.getDSFFun $ dsf in | |
toMaybe (functionName `notElem` accumulator) (let functionCalls = getDSFCalls dsf in |
This file contains 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
import System.IO | |
digits n | n < 10 = [n] | |
| otherwise = let (d, m) = quotRem n 10 in (digits d) ++ [m] | |
r = sum . digits . fact | |
fact n | n < 2 = 1 | |
| otherwise = n * fact (n-1) |
This file contains 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
// | |
// HomeViewController.m | |
// FreeCare | |
// | |
// Created by Shashi on 08/10/11. | |
// Copyright __MyCompanyName__ 2011. All rights reserved. | |
// | |
#import "HomeViewController.h" | |
#import "ClinicListViewController.h" |
This file contains 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
NSDictionary *dict = @{ | |
@"a":@"b", | |
}; | |
NSArray *arr = @[ | |
@"a", | |
@"b", | |
} |
This file contains 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
NSString *NSStringFromCATransform3D(CATransform3D t) { | |
return [NSString stringWithFormat:@"CATransform3D {\n%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf\n%lf %lf %lf %lf\n}", t.m11, t.m12, t.m13, t.m14, t.m21, t.m22, t.m23, t.m24, t.m31, t.m32, t.m33, t.m34, t.m41, t.m42, t.m43, t.m44]; | |
} |
This file contains 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
- (instancetype)initWithPoints:(NSArray *)points { | |
NSParameterAssert(points); | |
NSParameterAssert([points objectAtIndex:0]); | |
NSParameterAssert([[points objectAtIndex:0] isKindOfClass:[NSValue class]]); | |
self = [super init]; | |
if (self) { | |
for (NSValue *value in points) { |
This file contains 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
NSMutableArray *operations = [NSMutableArray array]; | |
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *checkedPuppet, | |
NSUInteger idx, | |
BOOL *stop) { | |
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *puppet, | |
NSUInteger idx2, | |
BOOL *stop2) { |
OlderNewer