Skip to content

Instantly share code, notes, and snippets.

View andrei-cacio's full-sized avatar
👀
🤔 👀

Andrei Cacio andrei-cacio

👀
🤔 👀
View GitHub Profile
@andrei-cacio
andrei-cacio / nginx.conf
Created October 9, 2015 19:24 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender). Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;
@andrei-cacio
andrei-cacio / react-native-setup-linux.md
Last active June 22, 2018 21:22
React native setup on Ubuntu/Linux

Guide for installing React Native on Linux (ubuntu 14.04)

Step 1: Install JDK 7

sudo apt-get install openjdk-7-jdk

Step 2: Download the Android SDK

@andrei-cacio
andrei-cacio / .bash_profile.sh
Last active May 19, 2016 18:52
pimp-my-bash-console1
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
@andrei-cacio
andrei-cacio / jquery-getter.js
Last active June 12, 2016 09:33
jQuery getter function
let nodeJquery = null;
export function getJquery(spy = false) {
if (!nodeJquery) {
const sinon = require('sinon');
const fakeDOM = require('jsdom').jsdom();
nodeJquery = require('jquery')(fakeDOM.defaultView);
}
return nodeJquery;
const fakeDOM = require(‘jsdom’).jsdom(); 
nodeJquery = require(‘jquery’)(fakeDom.defaultView);
import { View } from 'backbone';
import { getJquery }from './jquery-getter';
const $ = getJquery();
export class SimpleView extends View {
constroctor() {
super({ el: '#someDiv' });
}
const sinon = require('sinon');
const fakeDOM = require('jsdom').jsdom();
let nodeJquery = null;
let jquerySpies = null;
export function getJquery() {
if (!nodeJquery) {
nodeJquery = require('jquery')(fakeDOM.defaultView);
}
import { assert } from 'chai';
import proxyquire from 'proxyquire';
import { getJquerySpies, getJquery } from '../src/jquery-getter';
const $ = getJquery();
const getValidator = proxyquire('../src/validator', { jquery : $ }).default;
const isEmpty = proxyquire('../src/validator', { jquery : $ }).isEmpty;
const addClassFn = getJquerySpies().addClass;
import $ from 'jquery';
export const isEmpty = value => !value.length;
export default function getValidator(rule, inputSelector, valueGetter) {
return {
validate() {
const $input = $(inputSelector);
const value = valueGetter();