Skip to content

Instantly share code, notes, and snippets.

View alistra's full-sized avatar
🐈

Aleksander Balicki alistra

🐈
View GitHub Profile
NSMutableArray *operations = [NSMutableArray array];
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *checkedPuppet,
NSUInteger idx,
BOOL *stop) {
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *puppet,
NSUInteger idx2,
BOOL *stop2) {
- (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) {
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];
}
@alistra
alistra / gist:4659258
Created January 28, 2013 21:33
How indent should look like in Xcode
NSDictionary *dict = @{
@"a":@"b",
};
NSArray *arr = @[
@"a",
@"b",
}
@alistra
alistra / Home
Created August 17, 2012 01:56 — forked from Sterling715/Home
Menu page
//
// HomeViewController.m
// FreeCare
//
// Created by Shashi on 08/10/11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import "HomeViewController.h"
#import "ClinicListViewController.h"
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)
-- | 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
-- | 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
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
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