Skip to content

Instantly share code, notes, and snippets.

View gitmihalis's full-sized avatar

Mick gitmihalis

  • Chedoke Web Design
  • Canada
  • 04:10 (UTC -12:00)
View GitHub Profile
@gitmihalis
gitmihalis / scrape-follow-twitter-accounts.js
Created August 9, 2018 01:06
Scrape and follow twitter accounts with Google Puppeteer
'use strict';
const puppeteer = require('puppeteer');
async function scrapeLinks(destination) {
const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage();
await page.goto(destination);
@gitmihalis
gitmihalis / index.html
Last active July 12, 2018 17:01
mikefenos.com/discipline-fx v0
<div class="keys">
<div data-key="65" class="key">
<kbd>A</kbd>
<span class="sound">good evening</span>
</div>
<div data-key="83" class="key">
<kbd>S</kbd>
<span class="sound">just a man</span>
</div>
<div data-key="68" class="key">
exports.getGizmos = async (req, res) => {
const gizmos = await Gizmo.find().catch(next);
res.json(gizmos);
};
@gitmihalis
gitmihalis / AP.gulpfile.js
Created February 12, 2018 14:03
A gulpfile for starting AP news taks
// GENERAL WORKFLOW MANAGER *************************
// Helping you automate the start of a new work ticket and moving
// the relevant files to preproduction & production.
const gulp = require('gulp'),
open = require('gulp-open'),
fs = require('fs')
@gitmihalis
gitmihalis / index.js
Created October 17, 2017 12:43
http request with request lib
const request = require('request');
const fs = require('fs');
request.get('https://sytantris.github.io/http-examples/future.jpg')
.on('error', (err) => { throw err })
.on('data', (data) => console.log( 'Downloading ...', data.length ))
.on('response', (res) => {
let body = "";
body += 'status: ' + res.statusCode;
body += '\nmessage: ' + res.statusMessage;
@gitmihalis
gitmihalis / carrierwave.rb
Created October 16, 2017 12:40
Heroku attempts to destroy jr. developers reputation
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['AWS_SECRET_KEY_ID'],
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: 'eu-west-1'
}
config.fog_directory = 'credible-images'
config.fog_public = false
@gitmihalis
gitmihalis / avatar_uploader.rb
Last active October 16, 2017 12:39
Heroku attempts to destroy jr. developers reputation
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
process resize_to_fit: [200, 200]
# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog
class AddAssociationsToReview < ActiveRecord::Migration[5.1]
def change
add_reference :reviews, :author, foreign_key: true
add_reference :reviews, :receiver, foreign_key: true
add_reference :reviews, :catagory, foreign_key: true
end
end
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :email
t.string :password_digest
t.string :username
t.boolean :admin