Skip to content

Instantly share code, notes, and snippets.

View BideoWego's full-sized avatar
:octocat:
Yarp

Chris Scavello BideoWego

:octocat:
Yarp
View GitHub Profile
@BideoWego
BideoWego / say.js
Created January 11, 2019 21:29
Say something with speech synthesis in the browser or compatible JS APIs
function say(phrase) {
speechSynthesis.speak(new SpeechSynthesisUtterance(phrase));
}
// Ex.
say('Happy Friday :)');
@BideoWego
BideoWego / app.js
Last active December 11, 2017 20:13
Mongoose - Setup and boilerplate files for Mongoose with seeds, config for multiple environment databases and a REPL
// Put this before your routes
// ----------------------------------------
// Mongoose
// ----------------------------------------
const mongoose = require('mongoose');
app.use((req, res, next) => {
if (mongoose.connection.readyState) {
next();
} else {
@BideoWego
BideoWego / a_rails_rspec_checklist\README.md
Last active January 13, 2022 12:20
Rails Spec setup checklist, helper and support files

Rails RSpec Checklist

  • Ensure turbolinks is disabled for good measure

    • comment out gem
    • remove from javascript asset pipeline
    • remove from application layout
  • Add the following gems to Gemfile in a development, test group

    • hirb
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@miguelmota
miguelmota / randomDate.js
Last active December 21, 2022 16:27
Random date in JavaScript
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()))
}
console.log(randomDate(new Date(2012, 0, 1), new Date()))
@ndrut
ndrut / gist:4549230
Created January 16, 2013 17:57
Render an image in base64 using phantom js. Convert the base64 into a raw binary buffer, pass the binary buffer to GraphicsMagic which can write to a writable stream, collect the chunks of data in separate buffers, storing them in an array and then concatenate them all together.
// PhantomJS Render to base64 function
page.renderBase64('png', function(err, img) {
var image = {};
image.thumb = [];
final.full = new Buffer(img, 'base64'); // Convert the base64 encoded value into binary.
var thumbStream = new stream.Stream(); // Create a new writable stream
thumbStream.writable = true;
thumbStream.write = function (chunk) {
image.thumb.push(chunk); // Take the data written and store it into an array
@jaseemabid
jaseemabid / git tutorials.md
Last active March 24, 2024 00:07 — forked from netroy/git tutorials.md
Awesome git tutorials I am finding here and there
@WizardOfOgz
WizardOfOgz / gist:1012107
Created June 7, 2011 12:13
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',