Skip to content

Instantly share code, notes, and snippets.

@danyeah
danyeah / abi.json
Created December 19, 2023 10:01
MORALIS GET CONTRACT EVENTS
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "campaignId",
"type": "uint256"
},
{
@danyeah
danyeah / current-template.php
Created September 20, 2017 07:56
Wordpress current template
// Outputs the template used
// Usage: echo get_current_template(true);
// Credits: http://www.kevinleary.net/get-current-theme-template-filename-wordpress/
function define_current_template( $template ) {
$GLOBALS['current_theme_template'] = basename($template);
return $template;
}
function get_current_template( $echo = false ) {
@danyeah
danyeah / cycle_gridle_states.scss
Created June 28, 2017 19:53
Cycle all the gridle states
$statesNames : gridle_get_states_names();
%alignleft,
.alignleft {
float: left;
@each $name in $statesNames {
&--#{$name} {
@include gridle_state($name) {
float: left;
}
@danyeah
danyeah / optimize.sh
Created December 22, 2015 09:22
Bulk mozjpeg optimizer
#! /bin/sh
#this is where your files will be put
mkdir originals
# I run mozjpeg for everyfile in this dir, adding the suffix .tmp, and move the original file in /originals
for f in ./*.jpg;
do
mozjpeg -optimize -outfile $f.tmp $f;
mv $f originals/$f;
/* Add this to your css for debuggin purpose */
body:after {
content: "no mq";
position: fixed;
bottom: 0;
right: 0;
z-index: 999;
padding: 2px 5px;
background-color: rgba(0,0,0,.7);
color: white;
// Position fixed: pattern: https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/window-scroll-event.html#L36
// RequestAnimationFrame Shim
window.animFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 15);
};
})();
// Log all the methods of yourFunction object
console.log(Object.getOwnPropertyNames(yourFunction).filter(function (p) {
return typeof yourFunction[p] === 'function';
}));
[
{
"args":
{
"extend": false,
"to": "eol"
},
"command": "move_to"
},
{
@danyeah
danyeah / iframe.scss
Created March 16, 2015 11:37
Responsive iframe
/*
* Responsive video container
* http://www.smashingmagazine.com/2014/02/27/making-embedded-content-work-in-responsive-design/
*/
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;
@danyeah
danyeah / current-template.php
Last active August 29, 2015 14:14
Wordpress current template
// Outputs the template used
// Usage: echo get_current_template(true);
// Credits: http://www.kevinleary.net/get-current-theme-template-filename-wordpress/
function define_current_template( $template ) {
$GLOBALS['current_theme_template'] = basename($template);
return $template;
}
function get_current_template( $echo = false ) {