Skip to content

Instantly share code, notes, and snippets.

@timelf123
timelf123 / app.js
Last active October 29, 2016 20:02 — forked from ezekielchentnik/app.js
import express from 'express';
const app = express();
if (IS_DEV) {
require('piping')(); // https://www.npmjs.com/package/piping -- live reload app - replaces nodemon
}
//express routes, etc.
export default app;
@timelf123
timelf123 / gist:b04e2a4b7599d510fd7f7975bc5ec7fe
Created October 25, 2016 16:04 — forked from zachleat/gist:2008932
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@timelf123
timelf123 / find_one_by_id.js
Created September 15, 2016 20:36 — forked from ofirski/find_one_by_id.js
Add findOneById to MongoShell's DB collection
/****************************************************************************
* Add this snippet to ~/.mongorc in order to load it to any shell initiated
* Usage:
* db.myCollection.findOneById("5149cdbb62d5cbb22c000024")
* db.myCollection.findOneById("5149cdbb62d5cbb22c000024",{"field":1})
*****************************************************************************/
DBCollection.prototype.findOneById = function(objId ,fields, options ){
return this.findOne({"_id":ObjectId(objId)}, fields, options);
}
@timelf123
timelf123 / instagram-follow-script.js
Created September 12, 2016 18:07 — forked from underdown/instagram-follow-script.js
Instagram script for followers
/* source https://www.youtube.com/watch?v=UKi1NwqKCz8
_aj7mu _r4e4p _95tat _o0442
*/
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict()
@timelf123
timelf123 / gist:b76f73855ab83ee22c8a3d8b1497a72b
Created September 12, 2016 18:06 — forked from derekmartinla/gist:b719840542406322bb27
AdWords Countdown Ads Updater Script
/***************************************************************************************
* AdWords Countdown Ad Updater -- Find stale countdown ads and replace them with
* Ads that are updated with new dates.
* Version 1.0
* Created By: Derek Martin
* DerekMartinLA.com or MixedMarketingArtist.com
****************************************************************************************/
var DESCRIPTION2_TEXT = "Sale Ends In"
@timelf123
timelf123 / textLike.js
Created September 12, 2016 18:05 — forked from edinella/textLike.js
MongoDB Query similar to SQL "LIKE"
module.exports = function textLike(str) {
var escaped = str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
return new RegExp(escaped, 'i');
};
@timelf123
timelf123 / mongooseUniquenessValidation.js
Created September 12, 2016 17:42 — forked from edinella/mongooseUniquenessValidation.js
Mongoose uniqueness validator, case-sensitive or not
// context
var mongoose = require('mongoose');
mongoose.connect('mongodb://...');
/**
* Generates Mongoose uniqueness validator
*
* @param string modelName
* @param string field
* @param boolean caseSensitive
@timelf123
timelf123 / helipads.cpp
Created August 31, 2016 00:21 — forked from raws/helipads.cpp
Useful ArmA 3 debug console snippets
// Mark locations of nearby helipads
{
_marker = createMarkerLocal [(format ["helipad_%1", ([0, 1000] call BIS_fnc_randomInt)]), (position _x)];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorRed";
} forEach (nearestObjects [player, {"Land_helipadEmpty_F"}, 250]);
@timelf123
timelf123 / pre-commit
Created August 23, 2016 13:57 — forked from MarcoPriebe/pre-commit
pre-commit git hook to remove trailing whitespace
#!/bin/bash
#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
# Logic:
#
# The 'git stash save' fails if the tree is clean (instead of
# creating an empty stash :P). So, we only 'stash' and 'pop' if
@timelf123
timelf123 / gist:466185da57a82f3b72e5cbbb118465fc
Created August 16, 2016 18:17 — forked from dgieselaar/gist:8b20e9d593e1806a098b
Code splitting, lazy-loading, import statements, Angular + newNgRouter + ocLazyLoad + webpack
import _ from 'lodash';
import angular from 'angular';
import 'angular-new-router';
import 'oclazyload';
function AppController ( ) {
}
AppController.$routeConfig = [];