Skip to content

Instantly share code, notes, and snippets.

View pontusab's full-sized avatar
🦁

Pontus Abrahamsson pontusab

🦁
View GitHub Profile
@jsjaspreet
jsjaspreet / generateSchema.js
Created March 7, 2018 19:40
Generate GraphQL Schema and Docs programmatically (adopted from Relay github)
import fs from 'fs';
import path from 'path';
import { graphql } from 'graphql';
import { introspectionQuery } from 'graphql/utilities';
import schema from './src/schema/index';
(async () => {
const result = await graphql(schema, introspectionQuery);
if (result.errors) {
console.error(
@richardgill
richardgill / normalizeStyle.js
Created December 2, 2016 16:31
Makes React Native components look more consistent on different device sizes. The base size is an iPhone 6.
import _ from 'lodash'
import { Dimensions, PixelRatio } from 'react-native'
import { platformIsIos } from 'expresso-common/common/platform'
const { height } = Dimensions.get('window')
const iphone6Height = 667
const pixelRatio = PixelRatio.get()
const fieldsToNormalize = [
'fontSize',
'lineHeight',
@mfmendiola
mfmendiola / ArrayUtil.java
Last active April 5, 2023 19:10
ReadableArray and ReadableMap serialization helpers for the React Native—Android bridge.
/*
ArrayUtil exposes a set of helper methods for working with
ReadableArray (by React Native), Object[], and JSONArray.
MIT License
Copyright (c) 2020 Marc Mendiola
Permission is hereby granted, free of charge, to any person obtaining a copy
@knowbody
knowbody / ex-navigation.md
Last active July 17, 2023 10:14
My exponent's ex-navigation docs/thoughts

Exponent - ex-navigation

This is for now, for my personal use only, things might not be correctly explained here. For the official docs please check: https://github.com/exponentjs/ex-navigation/blob/master/README.md

Navigation bar configuration

On every screen you can use the built-in navigation bar, you can add a title, left button, right button or change navigation bar’s style. All you need to do is pass appropriate params to navigationBar in the route configuration:

import React, { Component } from 'react';
@psi-4ward
psi-4ward / LoginController.js
Created January 12, 2015 16:09
Sails.JS JWT Auth
// controllers/LoginController.js
module.exports = {
index: function(req, res) {
var email = req.param('email');
var password = req.param('password');
// delay everthing to prevent bruteforce, dos and timing attacks
setTimeout(function() {
@sean-hill
sean-hill / Ionic and ngCordova upload example
Last active May 6, 2019 01:52
Upload service for Ionic and ngCordova
Ionic and ngCordova upload example
from zway import ZWay, ZWayData
import sys
import signal
import binascii
from flask import Flask, jsonify, request, abort
app = Flask(__name__)
class ZWayHandler(ZWay):
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@franz-josef-kaiser
franz-josef-kaiser / Example.php
Last active December 21, 2015 06:18
A simple class based file (semi-auto-)loader that needs a path, relative to the plugins root directory as input argument.
<?php
$fileLoader = new FileLoader( 'assets/php' );
foreach ( $fileLoader as $file )
$fileLoader->loadFile( $file );
@franz-josef-kaiser
franz-josef-kaiser / toggle_metabox_bug.php
Last active December 21, 2015 06:08
Plugin to reproduce a bug that seems to toggle Admin Menu items, The whole post/post-new screen contents and user preferences for Screen Options (showing Meta Boxes). Everything needs confirmation. The plugin logs the responsible JavaScript Events to the console.
<?php
namespace WCMTest;
defined( 'ABSPATH' ) OR exit;
/** Plugin Name: Toggle MetaBox: Bug Inspect */
\add_action( 'admin_menu', array( __NAMESPACE__.'\AddMetaBox', 'getInstance' ) );
class AddMetaBox
{