Skip to content

Instantly share code, notes, and snippets.

Avatar

Taylor j. Eke tayeke

View GitHub Profile
@tayeke
tayeke / ph_probe.cpp
Last active Dec 29, 2020
Fish Tank Monitoring Arduino App
View ph_probe.cpp
#include "Arduino.h"
#include "ph_probe.h"
#include "EEPROM.h"
Ph_Probe::Ph_Probe(int pin, int calibrationAddress){
this->pin = pin;
this->calibrationAddress = calibrationAddress;
}
@tayeke
tayeke / emailer-findings.md
Last active Aug 29, 2015
Some beginning knowledge for making an email template
View emailer-findings.md

Things I learned sometimes the hard way about email templates

Keep in mind that realistically the only place anyone is ever going to see a responsive version of your email is in an iPhone.

  • All layout in tables no matter how many nested levels it becomes.
  • Add <tbody> because some browsers add it themselves and you want to account for it.
  • The only tags you should ever bother using are <table>,<tbody> / <thead>,<tr>,<td>,<span>,<div>,<img>
    • ya no p tag.
    • div only for stacking content vertically and accounting for presentation on the few clients that support embedded css and media queries.
  • Include alt and width and height on images.
@tayeke
tayeke / vagrant_shell_rails.sh
Last active Aug 29, 2015
Vagrant basic rails app install
View vagrant_shell_rails.sh
export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
sudo apt-get -qq update
sudo tasksel install postgresql-server
sudo apt-get install -y build-essential libssl-dev libyaml-dev git libtool libxslt-dev libxml2-dev libpq-dev gawk curl pngcrush imagemagick python-software-properties nodejs
sudo apt-add-repository -y ppa:rwky/redis
sudo apt-get update
sudo apt-get install -y redis-server
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.2
@tayeke
tayeke / .zshrc
Last active Aug 19, 2020
zsh/oh-my-zsh config
View .zshrc
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gentoo"
# Example aliases
@tayeke
tayeke / sublime-config-commands.json
Created Apr 2, 2014
Make Sublime like old eclipse sorta
View sublime-config-commands.json
[
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+shift+j"], "command": "join_lines" },
{ "keys": ["super+alt+down"], "command": "duplicate_line" },
{ "keys": ["super+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["super+shift+s"], "command": "save_all" }
]
@tayeke
tayeke / sprite-mixin.scss
Last active Aug 29, 2015
A SASS mixin for individual sprites.
View sprite-mixin.scss
@mixin sprite($x,$y,$width,$height,$background-color:transparent,$display:block,$sprite-sheet:'/images/my-sprite-sheet.png') {
display: $display;
background: url($sprite-sheet) no-repeat -1*$x -1*$y $background-color;
@include size($width $height);
}
# simple usage example
@include sprite(220,50,100,32);
@tayeke
tayeke / .server_functions
Last active Dec 27, 2015
inside .bashrc server_assets creates a webrick server in your folder and compiles sass in stylesheets/ and coffeescript in javascripts/ to bin folder
View .server_functions
function serve {
port="${1:-3000}"
ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => $port, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
}
function assets {
sass -w stylesheets:stylesheets/bin & \
coffee -o javascripts/bin -cw javascripts \
&& pg
}
function server_assets {
@tayeke
tayeke / image_preload.coffee
Last active Dec 24, 2015
Preloading images... $(img).on 'load' doesn't really work as you'd always expect and you can't preload hidden images, so this is the best preloader. TODO: Allow jquery selector of images... or allow container selector that loads all children
View image_preload.coffee
loadImages: (sources, _callback) =>
requests = []
requests.push($.get(source)) for source in sources
$.when.apply($, requests).done _callback
loadImagesProgress: (sources, _progress, _callback) =>
requests = []
requests.push($.get(source,_progress)) for source in sources
$.when.apply($, requests).done _callback
@tayeke
tayeke / infinite-scroll-gallery.coffee
Created Sep 24, 2013
Jquery infinite content scroll loading base class
View infinite-scroll-gallery.coffee
@tayeke
tayeke / evacuation.rb
Last active Aug 12, 2019
Example of how to do a live streaming Rails 4 model and controller using postgresql pubsub. + event module for formatting SSE.
View evacuation.rb
class Evacuation < ActiveRecord::Base
def self.notify_person_found
connection.execute "NOTIFY evac, #{connection.quote 'found person'}"
end
def self.on_person_found