Skip to content

Instantly share code, notes, and snippets.

View icirellik's full-sized avatar
💾
Staying Retro

Cameron Rollheiser icirellik

💾
Staying Retro
View GitHub Profile
@icirellik
icirellik / test.js
Created August 25, 2015 20:02
Pass data between beforeEach, afterEach and it in mocha tests.
var expect = require('expect');
describe.only('Sample', function () {
beforeEach(function () {
this.currentTest.value = 'Winning!';
});
it('Uses current test data', function () {
expect(this.test.value).to.equal('Winning!');
@icirellik
icirellik / react-test-with-context.js
Last active August 25, 2015 20:20
React Test with Context
var TestUtils = React.addons.TestUtils;
var context = {};
var elementWithContenxt = React.withContext(context, function () {
return new Element({
prop1: 'property'
});
});
https://www.npmjs.com/package/v8-profiler
'use strict';
var profiler = require('v8-profiler');
profiler.startProfiling();
// ...
var cpuProfile = profiler.stopProfiling();
require('fs').writeFileSync(__dirname + '/foo.cpuprofile', JSON.stringify(cpuProfile));
# Lint all files in the directory recursivly
eslint --fix --ext .js --ext .jsx .
@icirellik
icirellik / remove-empty-directories.sh
Created December 11, 2015 14:04
Find and Remove Empty Directories
# Prints all the empty directories in the local dir.
find . -type d -empty -print
# Removes all the empty directories in the local dir.
find . -type d -empty -delete
@icirellik
icirellik / junit-slf4j-logging.java
Created December 14, 2015 16:01
JUnit Enable slf4j
@BeforeClass
public static void setup() {
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace");
}
@icirellik
icirellik / npm-fast.sh
Created January 27, 2016 14:03
Faster NPM
# Disable the progress bar to speed up npm
npm set progress=false
@icirellik
icirellik / Jenkins Api.md
Last active April 25, 2017 09:55
Jenkins API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@icirellik
icirellik / postgres.sql
Created May 2, 2016 17:22
PostgreSQL Commands
-- Query a parameter
SHOW max_connections;
RESET max_connections;
SHOW ALL;
SELECT * FROM pg_settings;
SELECT *
FROM pg_settings
WHERE name = 'max_connections';
@icirellik
icirellik / catalina-logging.properties
Created July 21, 2017 17:44
Correct Logging in Tomcat Docker Containers
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software