Skip to content

Instantly share code, notes, and snippets.

Avatar

Eli White TheSavior

View GitHub Profile
@TheSavior
TheSavior / codegenConfig.js
Created Feb 25, 2020
Possible Codegen configuration
View codegenConfig.js
const Codegen = require('react-native-codegen');
const FlowParser = require('react-native-codegen-flow-parser');
const FabricObjcGenerator = require('react-native-codegen-fabric-objc-generator');
const ViewConfigGenerator = require('react-native-codegen-viewconfig-generator');
const MarkdownDocumentationGenerator = require('react-native-codegen-markdown-generator');
Codegen({
schema: new FlowParser({
files: ["src/*NativeComponent.js", "src/*NativeModule.js"],
otherConfig: true
View .gitconfig
[alias]
cleanup = "!git branch --merged | grep -v '\\*\\|master' | xargs -n 1 git branch -d && git remote prune origin"
cleanup-remote = "!git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete"
old-branches = "!git for-each-ref --sort=committerdate --format='%1B[1;34m %(authordate:relative) %1B[m %(refname:short) %1B[1;32m%(authorname)%1B[m' refs/remotes"
View proxyquireUtilsTest.js
var proxyquire = require('proxyquire');
describe('utils#getString', function() {
it('should print helper.msg', function() {
var HelperStub = {
msg: 'stub msg'
};
var utils = proxyquire('../server/utils', {
'./helper': HelperStub
View utils.js
var helper1 = require('./helper');
var Utils = {
getString: function() {
return helper1.msg;
}
};
module.exports = Utils;
View helper.js
var Helper = {
msg: 'from helper'
};
module.exports = Helper;
@TheSavior
TheSavior / testPrivateFunctions.js
Last active Oct 12, 2015
Test Private Functions
View testPrivateFunctions.js
var privateState = require('private-state');
var sinon = require('sinon');
var utils = require('./utils');
describe('utils#getDateString', function() {
it('should print value from formatString', function() {
var stub = sinon.stub().returns('today');
privateState.setFunctionForTesting(utils, 'formatString', stub);
var now = new Date(2015, 1, 1);
@TheSavior
TheSavior / exposePrivateFuncs.js
Last active Oct 13, 2015
Expose private functions object
View exposePrivateFuncs.js
var privateState = require('privatestate');
function formatString(date) {
return date.toDateString();
}
var Utils = {
getDateString: function(date) {
return 'today is ' + formatString(date);
}
@TheSavior
TheSavior / exposeFunctions.js
Last active Oct 13, 2015
Expose helpers on functions
View exposeFunctions.js
'use strict';
var privateState = require('privatestate');
function nameHelper(first, last) {
return first + ' ' + last;
}
function Person(first, last) {
this.first = first;
@TheSavior
TheSavior / exposeAdd.js
Last active Oct 13, 2015
Test Expose add and add2
View exposeAdd.js
var privateState = require('privatestate');
var utils = require('./utils');
describe('utils#add', function() {
it('should add two numbers', function() {
var add = privateState.getForTesting(utils, 'add');
var actual = add(2, 4);
assert.equal(actual, 6);
});
});
@TheSavior
TheSavior / SassMeister-input.scss
Created Aug 17, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
$placeholder-name: 'foo';
@for $i from 1 through 4 {
%#{$placeholder-name}-#{$i} {
content: $i;
}
You can’t perform that action at this time.