Skip to content

Instantly share code, notes, and snippets.

View paceaux's full-sized avatar
🌐
Obsessing with languagey things

Paceaux paceaux

🌐
Obsessing with languagey things
View GitHub Profile
@paceaux
paceaux / uiFrame.js
Created January 5, 2015 18:16
return a Tridion view frame as an object
var uiFrame = function (viewName) {
var frameIndex = 0, tridionView;
while (windowFrame = window.top.frames[frameIndex++])
{
if ( (tridionView = windowFrame.$display && windowFrame.$display.getView() ) && tridionView.getId() === viewName)
{
return tridionView;
}
}
console.log(tridionView);
@paceaux
paceaux / removeClassByPartialName.js
Last active October 28, 2015 20:43
Use this if you want to remove a class name from an element, but you don't know the full class name (ie, you only have a partial class name)
DOMTokenList.prototype.removeByPartial = function (className) {
for (var i = 0; i< this.length; i++) {
if (this[i].indexOf(className) !== -1) {
this.remove(this[i]);
}
}
};
@paceaux
paceaux / dabblet.css
Created December 31, 2014 17:40
Flexboxing lists
/**
* Flexboxing lists
*/
ul{
display:flex;
flex-direction: column;
margin: 0;
padding: 0;
height: 100vh;
@paceaux
paceaux / frameMediator.js
Created December 31, 2014 04:21
A mediator between you, the console, Anguilla, and Tridion
var AnguillaMediator = function() {
this._getAnguillaFrame = function() {
if (navHappy.isNavigating) {
return window.top.frames[1];
} else {
return window.top;
}
};
this.aFrame = this._getAnguillaFrame();
String.prototype.replaceAt = function () {
var rlen = arguments[2] == null ? 1 : arguments[2];
return this.substring(0, arguments[0]) + arguments[1] + this.substring(arguments[0] + rlen);
};
var currentItem = SDL.Client.UI.ApplicationHost.ViewModels.Navigation.currentNavigationItem();
var navHappy = {
init: function () {
this.newSrc = this.getNewSrc();
},
getCurrentItem: function () {
@paceaux
paceaux / form
Last active August 29, 2015 14:11
This makes a safe Form Object with information about all of the forms in a web page. Protects the JS from the Data
//wrap it all in an anonymous function
//This keeps our code safe from other JavaScript,and we don't polute the global namespace
(function() {
//create the encapsulating variable
var taForm;
//add a namespacing function so that we can inject modules to it
taForm = {
namespace: function(ns_string) {
var parts = ns_string.split('.'),
@paceaux
paceaux / vars
Created November 24, 2014 17:39
Stylus Variables bootstrap
$fontBody : "Roboto Condensed";
$fontHeaders : "din-condensed-web", sans-serif;
$fontCallout: "proxima-nova", sans-serif;
$colorNeutralWhitest : #ffffff;
$colorNeutralLightest : #ebebeb;
$colorNeutralDarkest : #646464;
$colorCoolDesat1: #323f50;
$colorCoolDesat2: #b8d098;
@paceaux
paceaux / BEMStylusGrid
Last active August 29, 2015 14:10
BEM + Grid + Stylus
colWidth = 5em
numCols = 12
thirdCol = ((numCols / 3) * colWidth)
fourthCol = ((numCols / 4) * colWidth)
eightCol = fourthCol /2
halfCol = ((numCols / 2) * colWidth)
[class*="--col"]
height: 100%;
@paceaux
paceaux / Golden
Created July 14, 2014 21:14
Golden Ratio Stylus Mixin
//======Golden Ratio Mixin
golden()
if @width
height: @width * .618
else
if @height
width: @height * .618
@paceaux
paceaux / BEMify
Created July 14, 2014 20:41
Stylus BEM mixin
e(name)
&__{name}
{block}
m(name)
&--{name}
{block}
.header
color: red
+e(element)