Skip to content

Instantly share code, notes, and snippets.

View darknoon's full-sized avatar

Andrew Pouliot darknoon

View GitHub Profile
@darknoon
darknoon / error_log.txt
Created April 25, 2019 19:30
Error attempting to install python.js
~/Developer/ML/js-ecosystem/modules/test-pythonjs (master #) $ yarn add python.js
yarn add v1.15.2
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
error /Users/andrew/Developer/ML/js-ecosystem/modules/test-pythonjs/node_modules/python.js: Command failed.
Exit code: 1
Command: node-gyp rebuild
Unpacking OpenEXR-2.3.0
-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darknoon
darknoon / flow.log
Created September 1, 2017 23:32
Flow errors
This file has been truncated, but you can view the full file.
Error: node_modules/apollo-client/node_modules/graphql-tag/node_modules/graphql/type/definition.js.flow:108
108: GraphQLList<GraphQLOutputType>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GraphQLList. This type is incompatible with
1196: export class GraphQLNonNull<T: GraphQLNullableType> {
^^^^^^^^^^^^^^^^^^^ union: GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | GraphQLEnumType | GraphQLInputObjectType | type application of class `GraphQLList`
Member 1:
203: GraphQLScalarType |
^^^^^^^^^^^^^^^^^ GraphQLScalarType
Error:
108: GraphQLList<GraphQLOutputType>
@darknoon
darknoon / ObjCClass.api.js
Created March 24, 2017 21:46
How to use ObjCClass library
const MyClass = new ObjCClass({
classname: 'MyClass',
superclass: NSButton,
_private: 'initial',
init() {
log("my custom init code. no need to call super here ");
this._private = 'test';
},
@darknoon
darknoon / createStructure.cocoascript.js
Created March 24, 2017 18:11
Create any arbitrary structure when you don't have a constructor exported for it
// Recursively create a struct
function makeStruct(def) {
if (typeof def !== 'object') {
return def;
}
const name = Object.keys(def)[0];
const values = def[name];
const structure = MOStruct.structureWithName_memberNames_runtime(name, Object.keys(values), null);
@darknoon
darknoon / ObjCClass.cocoascript.js
Created March 23, 2017 02:52
A little bit disgusting, but you can totally create classes with ivars in cocoa script :D
// Copy-paste this into 💎Sketch.app and run it 🔥
// Scroll to bottom for usage
// Use any C function, not just ones with BridgeSupport
function CFunc(name, args, retVal) {
// Due to particularities of the JS bridge, we can't call into MOBridgeSupport objects directly
// But, we can ask key value coding to do the dirty work for us ;)
function setKeys(o, d) {
const funcDict = NSMutableDictionary.dictionary()
funcDict.o = o
@darknoon
darknoon / whatthe.cocoascript.js
Created March 22, 2017 23:11
JSON.stringify doesn't really work on NSDictionary plist types does it…
const colorList = {
Haus: '#F3F4F4',
Night: '#333',
Sur: '#96DBE4',
'Sur Dark': '#24828F',
Peach: '#EFADA0',
'Peach Dark': '#E37059',
Pear: '#93DAAB',
'Pear Dark': '#2E854B',
};
@darknoon
darknoon / classWithIvar.cocoascript.js
Last active July 31, 2018 09:00
You can use ivars so you don't need to make so many hilarious classes
// Make a class with some handlers.
function Class(handlers){
var uniqueClassName = "fetchDelegate_" + NSUUID.UUID().UUIDString();
var cls = MOClassDescription.allocateDescriptionForClassWithName_superclass_(uniqueClassName, NSObject);
// Add each handler to the class description
for(var selectorString in handlers) {
var sel = NSSelectorFromString(selectorString);
cls.addInstanceMethodWithSelector_function_(sel, handlers[selectorString]);
}
// Add ivar to store instance-specific info
- (void)_setValue:(CGFloat)value forAnimatedKey:(NSString *)animationKey
{
POPSpringAnimation *ps = [self pop_animationForKey:animationKey];
if (!ps) {
ps = [POPSpringAnimation animation];
ps.property = [POPAnimatableProperty propertyWithName:animationKey initializer:^(POPMutableAnimatableProperty *prop) {
prop.readBlock = ^(DEViewerView *view, CGFloat *vs) {
vs[0] = [[view valueForKey:animationKey] floatValue];
};
prop.writeBlock = ^(DEViewerView *view, const CGFloat *vs) {