Skip to content

Instantly share code, notes, and snippets.

/**
* AuthController
*
* @description :: Server-side logic for managing auths
* @help :: See http://links.sailsjs.org/docs/controllers
*/
module.exports = {
index: function (req, res) {
var email = req.param('email');
@culttm
culttm / anyway.js
Created March 10, 2016 08:43 — forked from thers/anyway.js
When you need to initialize jquery plugin when using AngularJS (or something else which dinamically includes html). In case of AngularJS i was needed to render user-generated articales which contains HTML code inside of AngularJS app using $sce.trustAsHtml(), but the thing is about directives dont work inside this HTML and it shouldn't in fact (…
/**
* Executes given callback only if some element found by given selector
*
* @param {String} selector
* @param {Function} cb
*/
window.anyway = function (selector, cb) {
var
interval = setInterval(function () {
var el = $(selector);
@culttm
culttm / custom-nav-walker-usage.php
Created January 27, 2016 21:07 — forked from kosinix/custom-nav-walker-usage.php
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
<?php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
?>
@culttm
culttm / repeatable-fields-metabox.php
Created December 14, 2015 19:15 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
@culttm
culttm / gulpfile.js
Last active August 29, 2015 14:26
My web development gulpfile
var browserSync = require('browser-sync');
var del = require('del');
var gulp = require('gulp');
var pageSpeed = require('psi');
var plugins = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
// Optimize images
gulp.task('images', function () {
return gulp.src('app"<%= asset_path('$1') %>"**/*')
@culttm
culttm / trimSerialize.jquery.js
Last active August 29, 2015 14:26 — forked from darrennolan/trimSerialize.jquery.js
jQuery Trim Serialize form function. Leaves previous form intact, allows for giving selector for trim to run on. Defaults to only input[type=text] inputs.
(function($) {
/**
* Trim Form Elements before returning Serialize()
* @param {string} selector Defaults to 'input[type=text]'
* @return {serialized()} Returned jQuery serialize() string
*/
$.fn.trimSerialize = function(selector) {
// Deep clone form (to get all nested elements), then unbind everything off the clone
var clonedObject = $(this).clone(true).off();
@culttm
culttm / jquery.alterclass.js
Last active August 29, 2015 14:26 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@culttm
culttm / _grab.scss
Last active August 29, 2015 14:15 — forked from shiwano/_grab.scss
@charset "UTF-8";
@mixin grab-cursor {
// http://www.google.com/intl/en_ALL/mapfiles/openhand.cur
cursor: url('data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8='), all-scroll;
// cursor: -webkit-grab;
cursor: -moz-grab;
cursor: -o-grab;
cursor: -ms-grab;
cursor: grab;