Skip to content

Instantly share code, notes, and snippets.

View colleowino's full-sized avatar
🤹
Jest all the things

Cliff Owino colleowino

🤹
Jest all the things
View GitHub Profile
@colleowino
colleowino / browser-dom-man.js
Created November 14, 2017 01:47
Creating Dom element and adding it to the document
document.addEventListener('DOMContentLoaded', function() {
var checkPageButton = document.getElementById('checkPage');
checkPageButton.addEventListener('click', function() {
chrome.tabs.getSelected(null, function(tab) {
d = document;
var f = d.createElement('form');
f.action = 'http://gtmetrix.com/analyze.html?bm';
f.method = 'post';
@colleowino
colleowino / crop_seeder.rb
Created October 23, 2017 21:52
rails seeder using ffaker gem
# require 'ffaker'
items = ["beans", "maize", "tea"]
items.each do |item|
# each item should have an entry for each month
1.upto(12) do |month|
month_date = "2015-"+month.to_s+"-20 20:00:00"
Report.create( item: item, report_date: month_date, price: rand(100) )
end
@colleowino
colleowino / random-data.py
Created October 19, 2017 23:52
Using this file writing utility to get test data for kattis
import random
f = open("large.txt","w") #opens file with name of "test.txt"
countries = ["kenya","Uganda","Somalia","Ethiopia","Eritrea"]
limits = 5000
totals = str(limits*len(countries))
def println(text):
f.write(text+"\n")
@colleowino
colleowino / factorial.rb
Created April 30, 2017 00:39 — forked from flakyfilibuster/factorial.rb
Sweet ass factorials in Ruby! #1 - Iterative long #2 - Iterative short #3 - Recursive long #4 - Recursive short
# Factorial Recursive #
#######################
# Long Version:
def factorial(n)
if n == 0
return 1
else
return n*factorial(n-1)
@colleowino
colleowino / zsh.md
Created March 26, 2016 10:50 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@colleowino
colleowino / .gitconfig
Created February 11, 2016 17:54 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@colleowino
colleowino / CustomItemClickListener.java
Created January 10, 2016 20:06 — forked from riyazMuhammad/CustomItemClickListener.java
Easy Implementation of RecyclerView custom onItemClickListener
public interface CustomItemClickListener {
public void onItemClick(View v, int position);
}
package program.com.ba;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
* Created by faith on 9/13/15.
@colleowino
colleowino / tmux-cheatsheet.markdown
Last active August 29, 2015 14:27 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname