This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's mixin method to extend it with all your other utility methods | |
// like so: | |
_.mixin({ | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.replace(/</g,'<') | |
.replace(/"/g,'"') | |
.replace(/'/g,'''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////// | |
/// Grid Directive to Angular 1.0.0rc7 | |
////////////////////////////////////// | |
// To use: | |
// <script> | |
// var app = angular.module('myapp', ['ngGrid']); | |
// var Ctrl = function($scope) { $scope.todo = [...] } | |
// </script> | |
// <div ng-app="myapp"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://github.com/nikos/cmskern/blob/master/playapp/public/javascripts/widgets.js*/ | |
/** | |
* Widget for displaying a complete form as specified by the given schema. | |
*/ | |
angular.widget('my:form', function(element) { | |
this.descend(true); // compiler will process children elements | |
this.directives(true); // compiler will process directives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//github.com/infinitered/ignite | |
<Drawer | |
ref='drawer' | |
content={this.renderDrawerContent()} | |
styles={drawerStyles} | |
openDrawerOffset={100} | |
type='overlay' | |
tapToClose | |
panOpenMask={0.05} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MIT License | |
* | |
* Copyright (c) 2016 Richard Adams (https://github.com/enriched) | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'Expo' { | |
import { EventSubscription } from 'fbemitter'; | |
import { Component } from 'react'; | |
import { ViewStyle, ViewProperties, ColorPropType } from 'react-native'; | |
/** | |
* Expo Accelerometer | |
*/ | |
export namespace Accelerometer { | |
// TODO: good export type of x, y and z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ajv from 'ajv/dist/ajv.min'; | |
import AddIf from 'ajv-keywords/keywords/if'; | |
const makeValidator = (schema) => { | |
const ajv = new Ajv({ allErrors: true, coerceTypes: true }); | |
// Add If-then-else from ajv-keywords package | |
AddIf(ajv); | |
// Add custom keyword |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function withFields<S>(record: S, fields: (keyof S)[]) { | |
// Returns record with only properties specified in fields | |
return fields.reduce((acc: Partial<S>, key) => { | |
acc[key] = record[key] | |
return acc | |
}, {}) | |
} | |
function splitRecord<S extends object>(record: S, ...fields: Array<keyof S>) { | |
let withGivenFields = withFields(record, fields) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCount, useIncrement, useDecrement } from './store.Count' | |
export default function Counter () { | |
const count = useCount() | |
const increment = useIncrement() | |
const decrement = useDecrement() | |
return ( | |
<div> | |
<div>Count: {count}</div> |
OlderNewer