Skip to content

Instantly share code, notes, and snippets.

View kylealwyn's full-sized avatar
💾
(☞゚∀゚)☞

Kyle Alwyn kylealwyn

💾
(☞゚∀゚)☞
View GitHub Profile
@kylealwyn
kylealwyn / capitalizer.md
Last active October 22, 2015 18:57
capitalize all words of a string
function (text) {
  return text.toString().toLowerCase()
             .replace(/[_-]/g, ' ')
             .replace(/(?:^|\s)\S/g, function(a) {
                return a.toUpperCase();
              });
  }
// Only dependency is the lodash library
function deepDiff(oldObj, newObj) {
// Instantiate our changes obj
var changes = {};
// Make sure we are working with objects
oldObj = _(oldObj).value();
newObj = _(newObj).value();
#! /usr/bin/env node
const version = process.argv[2];
if (!version) {
throw new Error('Provide a new version (vX.X.X)')
} else if (version[0] !== 'v') {
version = 'v' + version
}
@kylealwyn
kylealwyn / app-store-icons.html
Last active August 27, 2018 16:20
Get It On App Store SVG
<!-- Apple App Store -->
<svg version="1.1" class="download-btn" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="-237.1 377.9 133.1 38.2" enable-background="new -237.1 377.9 133.1 38.2" role="img" aria-label="Download on the Apple store" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<g fill="currentColor">
<path d="M-157.1,389.6c0.2-0.1,0.3-0.3,0.4-0.6c0-0.1,0-0.1,0-0.2v-0.7c-1.2,0-1.7,0.3-1.7,1c0,0.2,0.1,0.4,0.2,0.6
s0.3,0.2,0.5,0.2C-157.5,389.8-157.3,389.7-157.1,389.6z"></path>
<path d="M-167,400.4c-0.5,0-1,0.2-1.4,0.5c-0.4,0.3-0.7,0.8-0.8,1.4c-0.1,0.3-0.1,0.5-0.1,0.6v1.6c0,0.7,0.2,1.3,0.6,1.8
c0.4,0.5,1,0.7,1.7,0.7c0.8,0,1.4-0.3,1.9-0.9c0.4-0.6,0.7-1.4,0.7-2.4c0-0.9-0.2-1.7-0.6-2.3C-165.6,400.7-166.2,400.4-167,400.4z
"></path>
<path d="M-163,386.4c-0.4,0-0.7,0.2-1,0.6c-0.2,0.3-0.3,0.7-0.3,1.1c0,0.4,0.1,0.8,0.3,1.1c0.2,0.4,0.5,0.6,1,0.6
c0.4,0,0.7-0.2,0.9-0.6c0.2-0.3,0.3-0.7,0.3-1.1s-0.1-0.8-0.3-1.1C-162.3,386.6-162.6,386.4-163,386.4z"></p
@kylealwyn
kylealwyn / merge-deep.js
Created December 8, 2016 21:15
recursively merge two javascript objects
/**
* Simple is object check.
* @param item
* @returns {boolean}
*/
function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
const webpack = require('webpack');
const webpackTargetElectronRenderer = require('webpack-target-electron-renderer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const BabiliPlugin = require('babili-webpack-plugin');
const Paths = {
Entry: './app/index',
Output: './build',
Public: 'http://localhost:9000/build/',
import axios from 'axios';
class Http {
constructor() {
this.axios = axios.create({
baseURL: 'http://localhost:4567',
timeout: 5000
});
}
@kylealwyn
kylealwyn / debounce-and-throttle.js
Last active January 18, 2017 22:20
ES6 versions of popular curried functions
function debounce(fn, delay) {
let timer;
return function(...args) {
clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(this, args);
}, delay);
}
}
@kylealwyn
kylealwyn / active-record-migration-expert.md
Created January 13, 2017 01:19 — forked from pyk/active-record-migration-expert.md
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb