Skip to content

Instantly share code, notes, and snippets.

View lmartins's full-sized avatar

Luis Martins lmartins

  • Goodwin Media, Multiweb
  • Portugal
View GitHub Profile
@lmartins
lmartins / SassMeister-input.scss
Created June 6, 2014 14:46
Generated by SassMeister.com.
// ----
// libsass (v0.8.6)
// ----
.Component{
font-size: 1em;
&-mode{
border: 1px solid red;
}
}
@lmartins
lmartins / module.js
Created June 8, 2014 15:32
Module Pattern
var Module = (function (){
var publicAPI = {};
var privateMethod = function () {
console.log("Log from the private method");
};
@lmartins
lmartins / module.js
Created June 8, 2014 15:34
Revealing Module Pattern with module extensions
// http://toddmotto.com/mastering-the-module-pattern/
var Module = (function () {
var _privateMethod = function () {
// private
// by convention private methods are prefixed with an underscore to
// differentiate them
};
@lmartins
lmartins / main.js
Created June 10, 2014 19:53
Node Selection utility
function $(a,b){
return(b||document)['querySelector'+(b=/\:first$/,b.test(a)?'':'All')](a.replace(b,''));
}
module.exports = (function() {
"use strict";
var topics = {};
return {
subscribe: function (topic, listener) {
// Create the topic's object if not yet created
if (!topics[topic])
topics[topic] = { queue: [] }
@lmartins
lmartins / app.js
Created June 18, 2014 19:13
Module based website organization
var events = require('./helpers/pubsub');
(function() {
"use strict";
var App = {
// this is out top level module, the module that sets up the
// namespace and secondary level modules
Views: {},
Features: {},
Modules: {},
@lmartins
lmartins / gulpfile.js
Created June 20, 2014 20:47
Gulpfile including Webpack JS building, ComponentJS, SASS and Image Optimization
'use strict';
var gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins(),
webpack = require('webpack'),
ComponentPlugin = require("component-webpack-plugin"),
info = require('./package.json'),
webpackCompiler;
@lmartins
lmartins / _icons-template.scss
Last active August 29, 2015 14:03
Gulp icons lodash error
@font-face {
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
}
%icon {
@lmartins
lmartins / gulpfile.js
Created June 28, 2014 09:56
Issues with icon font generation
'use strict';
var gulp = require('gulp'),
iconfont = require('gulp-iconfont'),
iconfontCss = require('gulp-iconfont-css');
var config = {
ICONS: {
src : 'sass/app/components/icons/svg/*.svg',
@lmartins
lmartins / ExtractNumber.js
Created July 25, 2014 11:08
Extract the number at the end of a string
var re = /[a-zA-Z]+([0-9]+)/;
var result = re.exec("portsConfiguration23");
console.log(result[1]);