Skip to content

Instantly share code, notes, and snippets.

View chrismitchell's full-sized avatar

Chris Mitchell chrismitchell

  • Sherwood Park, AB
  • 01:44 (UTC -06:00)
View GitHub Profile
@chrismitchell
chrismitchell / breakpoints.js
Last active February 28, 2018 20:35
breakpoints
window.breakpoints = {
xs: { min: 0, max: 480 },
sm: { min: 481, max: 768 },
md: { min: 769, max: 992 },
lg: { min: 993, max: 10000 },
is: function(size) {
return (
window.innerWidth >= breakpoints[size].min &&
window.innerWidth <= breakpoints[size].max
@chrismitchell
chrismitchell / greetings.rb
Created December 20, 2017 22:13
Time based greeting message
def greetings
now = time = Time.now
morning = today.beginning_of_day
noon = today.noon
evening = today.change( hour: 17 )
night = today.change( hour: 20 )
tomorrow = today.tomorrow
if (morning..noon).cover? now
@chrismitchell
chrismitchell / screen-sizes.sass
Last active May 3, 2017 16:13
bootstrap-sass media queries screen sizes
// https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss
//
//== Media queries breakpoints
//
//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
// Extra small screen / phone
//** Deprecated `$screen-xs` as of v3.0.1
$screen-xs: 480px !default;
//** Deprecated `$screen-xs-min` as of v3.2.0
@chrismitchell
chrismitchell / create_project.rb
Created February 21, 2017 04:54
Project creation for Keen.IO
require 'net/http'
require 'uri'
uri = URI.parse("https://api.keen.io/3.0/organizations/ORG_ID/projects")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request["Authorization"] = "ORGANIZATION_KEY"
request.body = "{
\"name\": \"My First Project\",
\"users\": [
@chrismitchell
chrismitchell / PULL_REQUEST_TEMPLATE.md
Last active March 15, 2016 19:33
Pull request template

Why:

This change addresses the need by:

@chrismitchell
chrismitchell / uninstall.sh
Created January 29, 2015 19:25
Uninstalling POW
curl get.pow.cx/uninstall.sh | sh
@chrismitchell
chrismitchell / git-tags-foo
Created May 30, 2014 20:33
Deleting tags on origin (not upstream)
If you have a tag named '12345' then you would just do this:
git tag -d 12345 (local)
git push origin :refs/tags/12345 (on Github)
@chrismitchell
chrismitchell / gist:9516420
Created March 12, 2014 21:10
TCPServer Error: Address already in use - bind(2)
Type this in your terminal to find out the PID of the process that's using the 3000 port:
$ lsof -wni tcp:3000
Then, use the number in the PID column to kill the process:
$ kill -9 PID
@chrismitchell
chrismitchell / save_to_csv.sql
Created April 8, 2013 16:36
MySQL - Save output as cdv
SELECT *
FROM TABLE_NAME
INTO OUTFILE '/tmp/filename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY ',';
<?php
if(in_array('mutualfund', $parts))
{
if(($handle = fopen(dirname(__FILE__). "../../shared_csv/top_mutual_funds.csv", "r")) !== FALSE){
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
echo "<pre>".print_r($data)." <br/></pre>";
}
fclose($handle);
}
else{