Skip to content

Instantly share code, notes, and snippets.

View mfd's full-sized avatar

Kami mfd

  • Checkmagush
View GitHub Profile
@kares
kares / jquery.parseparams.js
Created May 5, 2011 11:28
jQuery.parseParams - parse query string paramaters into an object
/**
* $.parseParams - parse query string paramaters into an object.
*/
(function($) {
var re = /([^&=]+)=?([^&]*)/g;
var decodeRE = /\+/g; // Regex for replacing addition symbol with a space
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );};
$.parseParams = function(query) {
var params = {}, e;
while ( e = re.exec(query) ) {
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@perrysmotors
perrysmotors / TriggerAnimationOnScroll.tsx
Last active October 9, 2022 08:34
Trigger an animation when scrolling past a given position in Framer X
import { Override, Data, motionValue, useTransform } from "framer"
// Keep track of the state of our application
const data = Data({ isPastLimit: false })
// Create a MotionValue to track contentOffsetY
const contentOffsetY = motionValue(0)
// Listen for changes to contentOffsetY
contentOffsetY.onChange(offset => (data.isPastLimit = offset < -52))
@fmal
fmal / fontsquirrel.png
Last active May 27, 2022 06:11
Font subsetting using pyftsubset
fontsquirrel.png
@shaneriley
shaneriley / mixins.jade
Created February 10, 2014 20:10
Jade mixins example
// Writing JS for everything is great and all, but I don't want to see JS
// inline in my Jade templates. Thankfully, there are ways of abstrating it
// into mixins!
// Want some Rails-like helpers?
mixin link_to(name, href)
- href = href || "#"
a(href="#{href}")= name
// How about a single editing point for a class name?
@jamesfalkner
jamesfalkner / liferay-7-wcm-adt-dump.ftl
Created November 24, 2015 21:45
A simple utility template to dump all available Liferay 7 WCM/ADT variables and their values.
<#-- dump.ftl
--
-- Generates tree representations of data model items.
--
-- Usage:
-- <#import "dump.ftl" as dumper>
--
-- <#assign foo = something.in["your"].data[0].model />
--
-- <@dumper.dump foo />
anonymous
anonymous / vid-to-gif.sh
Created October 20, 2017 18:52
#!/bin/bash
# rev4 - changes suggested by KownBash https://www.reddit.com/r/bash/comments/5cxfqw/i_wrote_a_simple_video_to_gif_bash_script_thought/da19gjz/
# Usage function, displays valid arguments
usage() { echo "Usage: $0 [-f <fps, defaults to 15>] [-w <width, defaults to 480] inputfile" 1>&2; exit 1; }
# Default variables
fps=15
width=480
@philippbosch
philippbosch / _animations.scss
Last active August 29, 2019 00:20
Compass mixins for CSS keyframe animations
@import "compass/css3/shared";
@mixin keyframes($name) {
@-webkit-keyframes $name {
@content;
}
@-moz-keyframes $name {
@content;
}
@ProgerXP
ProgerXP / magrabx.php
Last active September 6, 2018 08:43
Map grabber :: Yandex.Maps + jQuery + PHP/DOMDocument/XPathby Proger_XP :: http://proger.meOriginal article (Russian): http://habrahabr.ru/post/184334/
<?php
// Map grabber :: Yandex.Maps + jQuery + PHP/DOMDocument/XPath
// by Proger_XP :: http://proger.me
// Original article (Russian): http://habrahabr.ru/post/184334/
// In public domain. I appreciate backlinks.
function dl($url) {
require_once 'sqobot/lib/downwind.php';
return new Downwind($url, array(
@davilera
davilera / 00-readme.md
Last active November 14, 2017 12:43
Vanilla JavaScript VS libraries

Some examples of the things one can do with Vanilla JavaScript. Comparison of Vanilla JS to jQuery and Underscore.js.