Skip to content

Instantly share code, notes, and snippets.

View daino3's full-sized avatar

Dain Hall daino3

  • SpotOn, Inc
  • Chicago, Il
View GitHub Profile
@daino3
daino3 / ansible-bootstrap-ubuntu-16.04.yml
Created February 7, 2018 18:07 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@daino3
daino3 / main.yml
Created February 3, 2018 03:46
Installing Chrome Driver on ubuntu
- name: Update repositories cache and system deps
apt: name={{ item }} state=present update_cache=yes
with_items:
- libxi6
- libgconf-2-4
- name: Install chromedriver
apt: name={{ item }} state=present
with_items:
- chromium-chromedriver
@daino3
daino3 / main.yml
Last active February 2, 2018 23:49
Ansible role for installing phantomjs on Ubuntu
---
# exists at roles/phantomjs/tasks/main.yml
- name: Update repositories cache and system deps
apt: name={{ item }} state=present update_cache=yes
with_items:
- build-essential
- chrpath
- libssl-dev
- libxft-dev
@daino3
daino3 / example.js
Last active November 13, 2017 16:07
import React, {Component} from "react";
import {validateEmail, validateRequired} from "./validations";
class MyForm extends Component {
render(
return (<Input id="email"
placeholder="joey@email.com"
label="Email (*Required)"
type="text"
validators={[validateEmail, validateRequired]}
import axios from 'axios';
import {toCamelCase, toSnakeCase} from '../util';
import qs from 'qs';
// You can intercept requests or responses before they are handled by then or catch.
// https://github.com/axios/axios#interceptors
// Add a response interceptor and camelCase return data (for JS)
axios.interceptors.response.use((response) => {
response.data = toCamelCase(response.data);
package main
import (
"fmt"
"github.com/fatih/color"
"github.com/fsnotify/fsnotify"
"log"
"os"
"path/filepath"
"regexp"
@daino3
daino3 / image_transformatation.py
Last active December 12, 2021 11:51
Converting an image data uri to (28, 28) numpy array and writing to csv
from PIL import Image
import base64
import numpy
from io import BytesIO
data_uri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAAEuCAYAAAAwQP9DAAAU80lEQVR4Xu2da+hnRRnHv0qZKV42LDOt1eyGULoSJBGpRBFprBJBQrBJBBWGSm8jld5WroHUCyEXKutNu2IJ1QtXetULL0uQFCu24WoRsV5KpYvGYzM4nv6X8zu/mTnznPkcWP6XPTPzzOf7/L7/OXPmzDlOHBCAAAScETjOWbyECwEIQEAYF0kAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxCAgDsCGJc7yQgYAhDAuMgBCEDAHQGMy51kBAwBCGBc5AAEIOCOAMblTjIChgAEMC5yAAIQcEcA43InGQFDAAIYFzkAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxCAgDsCGJc7yQgYAhDAuMgBCEDAHQGMy51kBAwBCGBc5AAEIOCOAMblTjIChgAEMC5yAAIQcEcA43InGQFDAAIYFzkAAQi4I4BxuZOMgCEAAYyLHIAABNwRwLjcSUbAEIAAxkUOQAAC7ghgXO4kI2AIQADjIgcgAAF3BDAud5IRMAQggHGRAxDwTeDTkr4s6UxJ/5F0QNK3JD3lu1tbR49xLVld+jYXgcskvSTpIkmnS/qgpJMk/Tv8bHHZ7+PXPw6M5kRJx0t6Ijkv9uUsSW+U9Iykczfp4K8lfXiuztdoF+OqQZk2vBEwUzFTsK9mQNFkotGkhvFeSc+G86NRtdDfd0h6tIVASsSAcZWgSp0eCJjJ7JR0SRgZ2SjHDMp+38Jho7PXTAzkBUmvn1jWRTGMy4VMBJmBg
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
protected
module.exports = function(config) {
config.set({
// base path
basePath: './',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
Rails.application.configure do
# http://stackoverflow.com/questions/29417328/how-to-disable-cannot-render-console-from-on-rails
config.web_console.whitelisted_ips = '10.0.2.2'
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false