Skip to content

Instantly share code, notes, and snippets.

View zomars's full-sized avatar
🙏
Never stop learning

Omar López zomars

🙏
Never stop learning
View GitHub Profile
@gterrill
gterrill / booking-form.liquid
Last active December 16, 2015 04:09
Capturing a start date and number of days
{% comment %}
BookThatApp auto installed snippet. Changes made to this file will be lost if installed again.
{% endcomment %}
{% if product.metafields.bookthatapp.product_id %}
<div class="selector-wrapper">
{% capture attribute %}booking-start{% endcapture %}
<label for="{{ attribute }}">Rental Start Date:</label>
<input id="{{ attribute }}" type="text" name="properties[{{ attribute }}]" class="datepicker bta required bta-load-enable styled-input" autocomplete="off" size="12" data-handle="{{ product.handle }}" data-variant="{{ product.variants.first.id}}" data-mindate="{{ product.metafields.bookthatapp.lead_time }}" disabled="disabled" />
<label id="booked-out"></label>
/* ++++++++++++++++++ Highrise (http://highrisehq.com) ------------------------------------------------------ */
/* ------------------ Main App Styles ----------------------------------------------------------------------- */
@font-face {
font-family: 'Highrise Open Sans';
font-style: normal;
font-weight: 400;
src: url("//static.highrisehq.com/web/fonts/opensans-regular.eot?#iefix") format("embedded-opentype"), url("//static.highrisehq.com/web/fonts/opensans-regular.woff2") format("woff2"), url("//static.highrisehq.com/web/fonts/opensans-regular.woff") format("woff"), url("//static.highrisehq.com/web/fonts/opensans-regular.ttf") format("truetype"); }
@font-face {
font-family: 'Highrise Open Sans';
font-style: normal;
(function($) {
$.belowthefold = function(element, settings) {
var fold = $(window).height() + $(window).scrollTop();
return fold <= $(element).offset().top - settings.threshold;
};
$.abovethetop = function(element, settings) {
var top = $(window).scrollTop();
return top >= $(element).offset().top + $(element).height() - settings.threshold;
$app['upload'] = $app->share(
$app->extend(
'upload',
function ($upload, $app) {
$upload->setSanitizerCallback(
function ($filename) use () {
// do custom sanitising here...
}
);
@rossriley
rossriley / gist:bb16ea1b7933292a12a4
Created April 9, 2015 12:07
How to adjust upload size by contenttype
$app->initialize();
$app['upload'] = $app->extend('upload', function ($handler, $app) {
if ($app['request']->get('contenttype') == 'pages') {
$handler->addRule('size', ['size' => '100K'], '{label} uploads are limited to {size}', 'Page Image');
}
return $handler;
});
$app->run();
@robtarr
robtarr / inputs.html
Created February 2, 2012 02:27
Number Input Tests
<!doctype html>
<html>
<head>
<title>Number Test</title>
<style>
tr {
background: #ddd;
}
tr:nth-child(odd) {
@zomars
zomars / boltflow-bitbucket-deploy.php
Last active April 7, 2017 16:53
Script to deploy from bitbucket via webhook and bobdenotter's Boltflow script (https://github.com/bobdenotter/boltflow)
<?php
$repo_dir = '/home/username';
$branch_to_deploy = 'master';
$update = false;
// Parse data from Bitbucket hook payload
$payload = json_decode($_POST['payload']);
if (empty($payload->commits)) {
@geraintwhite
geraintwhite / DeviceEventEmitter.js
Created March 27, 2018 10:05
React Native Web Polyfills
// @flow
import EventEmitter from 'events';
export default new EventEmitter();
<?php
// This line needs to be called after initialize but before run
$app['upload'] = $app->extend(
'upload',
function ($handler, $app) {
if ($app['request']->get('contenttypeslug') && $app['request']->get('id')) {
$handler->setPrefix("/".$app['request']->get('contenttypeslug')."/".$app['request']->get('id'));
}
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<style>
.square,
.landscape { visibility: hidden; }
.portrait { visibility: visible; }
@media (min-aspect-ratio: 1/1) {
.portrait,
.landscape { visibility: hidden; }
.square { visibility: visible; }