Skip to content

Instantly share code, notes, and snippets.

View cemalyilmaz's full-sized avatar

Cemal YILMAZ cemalyilmaz

View GitHub Profile
@cemalyilmaz
cemalyilmaz / views_in_keystone.md
Created May 25, 2018 13:35 — forked from wuhaixing/views_in_keystone.md
How to Construct Yourself UI in KeystoneJS

#How to Construct Yourself UI in KeystoneJS

KeystoneJS provide Admin UI with one set of route controllers and view templates(list&item) for all of the models.But usually,you will need some custome views other than Admin UI to display models. Although the KeystoneJS documention don't tell us much about how to contruct custome view,we can learn this from the source code in skeleton project generated by yo keystone,or you can just check out the keystone demo project's source code.We will walk through the blog feature's implementation in this demo application to demonstrate how to construct custome UI in KeystoneJS application.

As KeystoneJS documention described in Routes & Views section,there is a routes/index.js file, where we bind application's URL patterns to the controllers that load and process data, and render the appropriate template.You can find following code in it:

app.get('/blog/:catego

@cemalyilmaz
cemalyilmaz / index.js
Created May 25, 2018 12:05 — forked from tmaclean-LV/index.js
Control user access to models in Keystone.js
// Place this with the other middleware inclusion in routes/index.js
keystone.pre('admin', middleware.enforcePermissions);
@cemalyilmaz
cemalyilmaz / debugging-node-elastic-beanstalk-woes
Created May 22, 2018 09:54 — forked from jmar777/debugging-node-elastic-beanstalk-woes
Debugging "Failed to run npm install. Snapshot logs for more details." on Elastic Beanstalk
First, we need to figure out what the actual error is. This is obviously frustrating given that the error message is intentionally truncating it.
1) SSH in to your node (various guides available for this if you're not already familiar with this).
2) Run this command (basically an Elastic Beanstalk wrapper command for npm install I found in a blog post [1]):
$ sudo /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2
3) Find the actual error message in the output from the npm install.
Once you know the error, it should hopefully be fairly obvious how to fix it. I've run into two different errors over the last couple days on Elastic Beanstalk:
The first was a dependency that was using the new "^X.Y.Z" version syntax, which is only supported in Node >= v0.10.26 (whereas Elastic Beanstalk only supports up to v0.10.21 as of today). The solution here was easy: hardcode a dependency version *prior* to when that dependency adopted to the new syntax.
//
// NSString+TCKN.h
// TCKN
//
// Created by Cemal Yilmaz on 18/12/15.
// Copyright © 2015 Rethib. All rights reserved.
//
#import <Foundation/Foundation.h>
void DumpObjcMethods(Class clz) {
unsigned int methodCount = 0;
Method *methods = class_copyMethodList(clz, &methodCount);
printf("Found %d methods on '%s'\n", methodCount, class_getName(clz));
for (unsigned int i = 0; i < methodCount; i++) {
Method method = methods[i];
#import <Foundation/Foundation.h>
@interface ScreenShotTaker : NSObject
+ (void) take;
@end
@cemalyilmaz
cemalyilmaz / NSDictionary+MTJSON.h
Last active August 29, 2015 14:20
NSDictionary to JSON String
#import <Foundation/Foundation.h>
@interface NSDictionary (MTJSON)
-(NSString*) mt_jsonString;
@end