Skip to content

Instantly share code, notes, and snippets.

Avishaan codeHatcher

Block or report user

Report or block codeHatcher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@codeHatcher
codeHatcher / enfile-limit-fix-meteor.sh
Created Oct 24, 2017
Fix meteor enfile issue on mac "Error: ENFILE: file table overflow, scandir '/Users/ronaldo.pontes/code/rea..."
View enfile-limit-fix-meteor.sh
#!/bin/bash
sudo -v
echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536 65536
echo "add 'ulimit -n 65536 65536' to your .bashrc or .zshrc file"
echo "restart shell"
@codeHatcher
codeHatcher / add-reading-list-from-chrome.scpt
Created Jul 30, 2017
Love using Chrome but miss being able to add the current page to your 'reading list' in Safari, run this script
View add-reading-list-from-chrome.scpt
-- Script will open Chrome, put url of active view onto clipboard, open Safari, add to reading list, wait for abit while added to reading list
tell application "Google Chrome"
activate
set the clipboard to (URL of active tab of first window as text)
end tell
tell application "Safari"
activate
add reading list item (get the clipboard)
View image-resize.js
// Call this function *after* the page is completely loaded!
function resize_images(maxht, maxwt, minht, minwt) {
var imgs = document.getElementsByTagName('img');
var resize_image = function(img, newht, newwt) {
img.height = newht;
img.width = newwt;
};
for (var i = 0; i < imgs.length; i++) {
@codeHatcher
codeHatcher / swapfile.h
Last active Jan 6, 2017
Create swapfile on
View swapfile.h
#!/bin/bash
#https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
sudo fallocate -l 2G /swapfile
ls -lh /swapfile
chmod 0600 /swapfile
sudo mkswap /swapfile
@codeHatcher
codeHatcher / jsdoc.js
Created Oct 13, 2016
"complex" jsdoc example
View jsdoc.js
/**
* sort data
*
* @param {String[]} data - data points
* @param {String[]} labels - labels in same order as data points
* @param {Object} options - labels in same order as data points
* @param {Number} sort - direction to short (ascending, descending)
* @return {Object} sorted - sortedData object
* @return {Number[]} sorted.data - data sorted in order
* @return {String[]} sorted.labels - labels for data returned in matching order
@codeHatcher
codeHatcher / .vimrc
Last active Jul 21, 2016
My .vimrc that everyone has been asking for
View .vimrc
" https://github.com/Valloric/YouCompleteMe/issues/611
"let $PATH = '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7'.$PATH
let $PATH = '/usr/local/bin:'.$PATH
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
@codeHatcher
codeHatcher / dataFormatExamples.js
Last active Jul 11, 2016
Dashboard MongoDB object format
View dataFormatExamples.js
// basic json document template
var graphBaseTemplate = {
'_id': '0012938801abfe', //auto assigned by database
'kHospitalName': 'kKaiser',
'kHospitalId': '0012938801abf1',
'kGraphName': 'kCostSavings',
'kGraphId': '0012938801abf2',
'kDepartmentName': 'kHospitalWide',
'kDepartmentId': '0012938801abf3',
'datasets': datasets
@codeHatcher
codeHatcher / .tern-project
Created Aug 12, 2015
TernJS MeteorJS general config file
View .tern-project
{
"libs": [
"browser",
"jquery",
"underscore"
],
"loadEagerly": [
"*.js", "*/*.js", "*/*/*.js", "*/*/*/*.js"
],
"dontLoad": [
@codeHatcher
codeHatcher / jasmineMultiTestOneSpecAsync.js
Created Oct 30, 2014
Jasmine test multiple values with one spec asyncly
View jasmineMultiTestOneSpecAsync.js
describe("A calculator", function() {
it("should square correctly", function(done) {
[
{ number: 2, answer: 4},
{ number: 3, answer: 9},
{ number: 4, answer: 16}
].forEach(function(problem, index, array){
// we will pretend to calculate with our fnc here
setTimeout(function(){
var calcAnswer = problem.number*problem.number;
@codeHatcher
codeHatcher / jasmineMultiTestOneSpec.js
Created Oct 30, 2014
Jasmine test multi values with same 'it' spec
View jasmineMultiTestOneSpec.js
describe("A calculator", function() {
it("should square correctly", function() {
[
{ number: 2, answer: 4},
{ number: 3, answer: 9},
{ number: 4, answer: 16}
].forEach(function(problem, index, array){
// we will pretend to calculate with our fnc here
var calcAnswer = problem.number*problem.number;
expect(calcAnswer).toEqual(problem.answer);
You can’t perform that action at this time.