Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install build-essential
/**
* 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');
var DetectSwipeDirection;
DetectSwipeDirection = (function(){
function DetectSwipeDirection(options){
var defaults = {
delta: 0,
leftCallback: function(){},
rightCallback: function(){},
@culttm
culttm / clip.js
Created April 15, 2016 08:22
Simple clipboard function
function clip(text) {
var copyElement = document.createElement('input');
copyElement.setAttribute('type', 'text');
copyElement.setAttribute('value', text);
copyElement = document.body.appendChild(copyElement);
copyElement.select();
document.execCommand('copy');
copyElement.remove();
}
@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);
npm uninstall `ls -1 node_modules | tr '/\n' ' '`
/*!
* jQuery Validation Plugin v1.14.0
*
* http://jqueryvalidation.org/
*
* Copyright (c) 2015 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
@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 / CustomOwlCarousel.coffee
Last active October 12, 2015 22:23
Init owlCarousel with custom DOM options
###
Init owlCarousel with custom DOM options
http://www.owlcarousel.owlgraphic.com/docs/api-options.html
@plugin-options
@responsive-options
@nav-text
https://github.com/smashingboxes/OwlCarousel2
###