Skip to content

Instantly share code, notes, and snippets.

View alistra's full-sized avatar
🐈

Aleksander Balicki alistra

🐈
View GitHub Profile
- (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
@alistra
alistra / gist:c6c16e4b26736d318766
Created June 13, 2015 08:37
pip install python-dateutil on OS X 10.11
pip python-dateutil
The directory '/Users/alistra/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/alistra/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting python-dateutil
Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB