Skip to content

Instantly share code, notes, and snippets.

View diomed's full-sized avatar
:octocat:
hold my catnip!

May Kittens Devour Your Soul diomed

:octocat:
hold my catnip!
View GitHub Profile
@brendo
brendo / EventTutorial.md
Created May 23, 2011 09:40 — forked from nickdunn/EventTutorial.md
Symphony Events: A Detailed Look

Forms have been an integral part of any interactive site since the dawn of time — they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted (input), the website will take 'action' and do something with the data (processing) and then provide a user with the result (output). Symphony provides this logic layer via events.

This tutorial is about customising Symphony events. You will learn about:

  • event execution conditions (load and __trigger)
  • field naming and the $_POST array
  • creating related entries in two or more sections at the same time, aka. event chaining
  • event priority (execution order)
  • entirely custom events
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
/*
* mtippy - a jQuery tooltip plugin
* v1.0.0 - 20120525
* (c) 2012 Miguel Mota http://www.miguelmota.com
* Released under the MIT license
*/
(function($) {
var methods = {
@giuseppeg
giuseppeg / fuzzbuzz.js
Last active July 6, 2022 08:55
FizzBuzz solution with just one comparison:Bitwise operations, using predefined 0-15 numbers masksource: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
// FizzBuzz solution with one comparison:
// Bitwise operations, using predefined 0-15 numbers mask
// live demo: http://jsfiddle.net/TbAuQ/
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"],
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00
c = 0;
@aras-p
aras-p / preprocessor_fun.h
Last active June 21, 2024 12:20
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rxaviers
rxaviers / gist:7360908
Last active June 30, 2024 10:49
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@davidvandenbor
davidvandenbor / grav-cms-twig-loops.twig
Last active November 6, 2019 07:00
GRAV cms TWIG loops
{# find the children (subpages) of a parent page, in this case the "about" page #}
<ul>
{% for p in page.find('/about').children if p != page %}
<li><a href="{{p.url}}">{{ p.title }}</a></li>
{% endfor %}
</ul>
{# show all the pages with a certain category, in this case "cars" #}
<h2>All the CAR posts</h2>
<ul>
@yakunichkin
yakunichkin / JS Up Button
Created June 21, 2015 17:41
Animation UpButton scrolling
<script type="text/javascript">
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function(){
@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages
@pixelomo
pixelomo / ScrollToTop.html
Last active March 8, 2017 10:43
Creating a simple scroll to top button. At the bottom of the document you'll see a button with the id of top. Below this I've included a link to jQuery followed by a simple script. First there's a function that is checking what the current window screoll position is, you can see this being logged in the console. When this reaches position 250 it…
<html>
<head>
<style type="text/css">
body{
text-align: center;
font-family: sans-serif;
}
h1{
font-size: 45px;
}