Skip to content

Instantly share code, notes, and snippets.

View patrixd's full-sized avatar

Patricia Juárez Muñoz patrixd

View GitHub Profile
@millermedeiros
millermedeiros / gist:882682
Created March 23, 2011 05:47
RequireJS Async Load Plugin
/*!
* RequireJS plugin for async dependency load like JSONP and Google Maps
* @author Miller Medeiros
* @version 0.0.1 (2011/03/23)
* Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
define(function(){
function injectScript(src){
var s, t;
@brandonheyer
brandonheyer / rgbToHSL.php
Last active June 12, 2021 06:49
PHP snippet to convert RGB to HSL and HSL to RGB.
<?
function rgbToHsl( $r, $g, $b ) {
$oldR = $r;
$oldG = $g;
$oldB = $b;
$r /= 255;
$g /= 255;
$b /= 255;
@yckart
yckart / jquery.addrule.js
Last active December 29, 2022 12:16
Add css-rules to an existing stylesheet - http://stackoverflow.com/a/16507264/1250044
/*!
* jquery.addrule.js 0.0.2 - https://gist.github.com/yckart/5563717/
* Add css-rules to an existing stylesheet.
*
* @see http://stackoverflow.com/a/16507264/1250044
*
* Copyright (c) 2013 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/11/23
**/
@patrixd
patrixd / AppConfig.as
Last active December 17, 2015 09:19
Basic example using Robotlegs2 and Starling. Note: to use Inject in Robotlegs, the class that use them must exist in the context. It was weird to me because I came of Parsley. In Parsley you only declare what to inject you do not declare who inject them too. This example also has an splash in pure actionscript.
package {
// imports ...
public class AppConfig implements IConfig
{
[Inject]
public var context:IContext;
[Inject]
public var commandMap:ISignalCommandMap;
@davidnormo
davidnormo / main.js
Last active May 17, 2022 16:56
jsPDF as email attachment
var pdf = new jsPDF();
pdf.text(0, 0, 'Hello World!');
var pdfBase64 = pdf.output('datauristring');
window.plugin.email.open({
to: ['to@email.com'],
subject: 'New PDF!',
body: 'Hi there, here is that new PDF you wanted!',
isHTML: false,
attachments: [pdfBase64]
@patrixd
patrixd / loadScript.js
Last active August 29, 2015 14:10
Basic loader - Loads a script only once
loadedScript = {};
loadingScript = {};
pendingScriptSuccess = {};
function loadScript (url, success, async) {
if(loadedScript[url]) {
success();
return;
}
@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 15, 2024 16:01
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@patrixd
patrixd / pointerEvents.js
Last active March 27, 2016 22:00
Touch and Mouse events. For compatibility with any kind of device. Touch, Click and both. https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/ http://www.html5rocks.com/en/mobile/touchandmouse/
$.fn.pointerEvent = (function () {
var $el = $(this),
_eventData = "",
_touchEventName,
_bindEvent = function (nameListener, mouseEvent, data, callback) {
if ($el.length === 0)
return;
_touchEventName = _getTouchEventName(mouseEvent);
if (_.isFunction(data)) {
callback = data;