Skip to content

Instantly share code, notes, and snippets.

View m-coding's full-sized avatar

michelle m-coding

View GitHub Profile
animation: rock 4.5s infinite;
@keyframes rock {
from {
transform: rotate(0deg) translate(50px,0);
animation-timing-function: ease-in-out;
}
50% {
transform: rotate(0) translate(-150px,0);
animation-timing-function: ease-in-out;
@m-coding
m-coding / css-supports.js
Created May 28, 2016 04:21 — forked from codler/css-supports.js
CSS.supports() Polyfill
/*! CSS.supports() Polyfill
* https://gist.github.com/codler/03a0995195aa2859465f
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
if (!('CSS' in window)) {
window.CSS = {};
}
if (!('supports' in window.CSS)) {
window.CSS._cacheSupports = {};
window.CSS.supports = function(propertyName, value) {
@m-coding
m-coding / About.md
Last active May 14, 2016 03:59
My Microsoft Visual Code Settings

I am trying out Microsoft's VS Code editor to see if it is good enough to replace Sublime.

Below is a work in progress of transferring settings I liked in Sublime.

@m-coding
m-coding / fix_github_https_repo.sh
Created April 25, 2016 01:04 — forked from m14t/fix_github_https_repo.sh
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
commit 6e59bfbc45983b8680f023ac07a34cabe80985e5
Author: Adam Jakubek <ajakubek@gmail.com>
Date: Mon Aug 13 01:24:39 2012 +0200
Prevent focus stealing when opening diverted URLs
This patch allows to override current Chrome's behavior, where opening a
link from an external application (e.g. mail client) causes Chrome's
window to steal focus.
It works by introducing a new command line switch
@m-coding
m-coding / LocalStorage.js
Created April 12, 2016 07:38 — forked from picode7/LocalStorage.js
LocalStorage JavaScript Module
/**
* Check if localStorage is supported const isSupported: boolean
* Check if localStorage has an Item function hasItem(key: string): boolean
* Get the amount of space left in localStorage function getRemainingSpace(): number
* Get the maximum amount of space in localStorage function getMaximumSpace(): number
* Get the used space in localStorage function getUsedSpace(): number
* Backup Assosiative Array interface Backup
* Get a Backup of localStorage function getBackup(): Backup
* Apply a Backup to localStorage function applyBackup(backup: Backup, fClear: boolean = true, fOverwriteExisting: boolean = true)
* Dump all information of localStorage in the console function consoleInfo(fShowMaximumSize: boolean = false)
@m-coding
m-coding / regex-yyyy-mm-dd.js
Last active January 22, 2024 06:36
javascript regex to match date pattern YYYY-MM-DD
// allows YYYY/M/D and periods instead of slashes
// http://stackoverflow.com/questions/24989065/trying-to-validate-yyyy-mm-dd
/^\d{4}[\/.]\d{1,2}[\/.]\d{1,2}$/
// YYYY-MM-DD and YYYY-M-D
// http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript
/^\d{4}\-\d{1,2}\-\d{1,2}$/
// YYYY-MM-DD
// https://gist.github.com/arth2o/8471150
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}
// usage: $(‘div.unevenheights’).setAllToMaxHeight();
@m-coding
m-coding / custom-model-with-view.js
Created April 2, 2016 04:36 — forked from oroce/custom-model-with-view.js
backbone.js CustomModel with View
var customModel = new CustomModel();
var sampleView = new Backbone.View({
model: customModel
});
@m-coding
m-coding / Handlebars- Backbone.js
Created March 29, 2016 06:59 — forked from amatiasq/Handlebars- Backbone.js
This allow Handlebars to look up Backbone Model's attributes: {{ user.address.street }} If user is a Backbone Model this will become user.get("address").street And if user.get("adress") is also a Backbone Model this will be produced: user.get("address").get("street")
Handlebars.JavaScriptCompiler.prototype.nameLookup = function(parent, name, type) {
var result = '(' + parent + ' instanceof Backbone.Model ? ' + parent + '.get("' + name + '") : ' + parent;
if (/^[0-9]+$/.test(name)) {
return result + "[" + name + "])";
} else if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return result + "." + name + ')';
} else {
return result + "['" + name + "'])";
}
};