Skip to content

Instantly share code, notes, and snippets.

View rizkysyazuli's full-sized avatar

Rizky Syazuli rizkysyazuli

View GitHub Profile
@rizkysyazuli
rizkysyazuli / script.js
Last active February 20, 2020 16:10
[JavaScript - SPA Starter] Starter script for a single-page AJAX application.
/**
* Extending Paul Irish’s DOM-ready execution for single-page AJAX application.
* This snippet executes methods based on URL hash values.
*
* Original implementation by Paul Irish & Viget Labs: http://bit.ly/aEwAny
* Requires jQuery Address plugin: http://bit.ly/11wNxa
*
* TODO: support HTML5 History API.
*
*/
@rizkysyazuli
rizkysyazuli / edge-webfonts.js
Created October 25, 2012 08:38
JavaScript: Adobe Edge Web Fonts list
{
"Abel": "abel",
"Abril Fatface": "abril-fatface",
"Aclonica": "aclonica",
"Acme": "acme",
"Actor": "actor",
"Adamina": "adamina",
"Advent Pro": "advent-pro",
"Aguafina Script": "aguafina-script",
"Aladin": "aladin",
@rizkysyazuli
rizkysyazuli / index.jade
Last active February 20, 2020 16:09
[Jade - Starter HTML] Starter Jade template with Foundation #html #jade #foundation
doctype 5
// paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
//if IE 8
<html class="no-js lt-ie9" lang="en">
//[if gt IE 8]><!
html(class="no-js", lang="en")
//<![endif]
head
@rizkysyazuli
rizkysyazuli / jquery-sheepit-template-basic.html
Created January 14, 2013 15:48
jQuery: SheepIt Form Template
<!-- jQuery SheepIt HTML Template - http://goo.gl/7VrJu -->
<!-- start: SheepIt Form -->
<div id="myform">
<!-- start: Form template-->
<div class="template" id="myform_template">
<label for="myform_#index#_name">Name <span id="myform_label"></span></label>
<input id="myform_#index#_name" name="myform_name[#index#]" type="text"/>
<div>
<a href="#" id="myform_remove_current" class="icon-remove-sign"></a>
@rizkysyazuli
rizkysyazuli / jquery-sheepit-config-basic.js
Created January 14, 2013 16:00
jQuery: SheepIt Config
// jQuery SheepIt Configuration - http://goo.gl/7VrJu
// SheepIt plugin defaults
var defaults = {
separator: '',
// controls
allowRemoveLast: true,
allowRemoveCurrent: true,
allowRemoveAll: false,
allowAdd: true,
@rizkysyazuli
rizkysyazuli / foundation-top-bar-reset.scss
Created April 8, 2013 17:36
Foundation: Top Bar Background Colour Reset
.top-bar {
background-color: transparent;
&.expanded {
.title-area {
background-color: transparent;
}
}
}
@rizkysyazuli
rizkysyazuli / kirbycms-pagination.php
Created September 30, 2013 20:41
Kirby CMS Snippets: pagination with page numbers.
<? if ($articles->pagination()->hasPages()): ?>
<ul class="pagination">
<? if($articles->pagination()->hasNextPage()): ?>
<li><a class="prev" href="<?= $articles->pagination()->nextPageURL() ?>">Older posts</a></li>
<? endif; ?>
<? foreach($articles->pagination()->range(5) as $paging): ?>
<li><a href="<?= $articles->pagination()->pageURL($paging); ?>"><?= $paging; ?></a></li>
<? endforeach ?>
@rizkysyazuli
rizkysyazuli / google-maps.js
Last active February 20, 2020 11:29
[JavaScript - Google Maps] Maps with custom styles and map markers. #javascript #jquery
// sanity checks
var $map = $('.map-container');
if ($map.length) {
// on page load, run the main map handler
google.maps.event.addDomListener(window, 'load', originsMap);
}
// custom map style. see: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
var mapStyle = [{featureType:'water',elementType:'all',stylers:[{hue:'#281d01'},{saturation:100},{lightness:-89},{visibility:'simplified'}]},{featureType:'landscape',elementType:'all',stylers:[{hue:'#d2ac43'},{saturation:47},{lightness:-39},{visibility:'on'}]},{featureType:'road',elementType:'all',stylers:[{hue:'#d2ac43'},{saturation:-39},{lightness:-15},{visibility:'off'}]},{featureType:'poi',elementType:'all',stylers:[{hue:'#d2ac43'},{saturation:32},{lightness:-30},{visibility:'off'}]},{featureType:'administrative.province',elementType:'all',stylers:[{hue:'#d2ac43'},{saturation:61},{lightness:7},{visibility:'off'}]},{featureType:'administrative.locality',elementType:'all',stylers:[{hue:'#d2ac43'},{saturation:61},{lightness:54
@rizkysyazuli
rizkysyazuli / element-range.js
Last active February 20, 2020 11:30
[JavaScript - Check if element in viewport] A function to detect if a "page" element is visible in the browser viewport. It was used on a single-page website i made for changing the address, lazy-loading assets and updating the navigation menu. #javascript #jquery
function range() {
// the outer most container element that wraps the pages
var $viewport = $('.viewport');
// the container element for each pages
var $page = $('.page');
// viewport dimension
var viewX = $viewport.scrollLeft(),
viewY = $viewport.scrollTop(),
viewWidth = $viewport.width(),
@rizkysyazuli
rizkysyazuli / mixins-size.scss
Last active February 20, 2020 16:14
[SCSS - Sizing] #scss
@mixin size($width, $height: $width) {
width: $width;
height: $height;
}