Skip to content

Instantly share code, notes, and snippets.

View robmcalister's full-sized avatar
🐢
Slowly, but surely.

Robbie McAlister robmcalister

🐢
Slowly, but surely.
View GitHub Profile
@nepsilon
nepsilon / 3-vim-tips-with-external-commands.md
Last active December 5, 2018 17:23
3 Vim tips with external commands — First published in fullweb.io issue #95

3 Vim tips with external commands

Vim has this ! special character that will run any shell command without having to close it. Here are 3 ways I often use it:

1. Format a JSON blob:

:%!python -m json.tool

2. Count number of characters in a file:

@shazron
shazron / app.js
Created May 23, 2013 22:03
RequireJS with Cordova example (app.js)
requirejs(['cordova.js'],
function () {
// start of require
// cordova is now available globally
var exec = cordova.require('cordova/exec');
var app = {
// Application Constructor
@nepsilon
nepsilon / 5-ways-to-check-if-a-string-contains-a-substring-in-avascript.md
Last active February 28, 2017 16:15
5 ways to check if a string contains a substring in Javascript — First published in fullweb.io issue #89

5 ways to check if a string contains a substring in Javascript

1. ES6 .includes():

var S = "fullweb";
S.includes("web");

2. RegExp .search():

@robmcalister
robmcalister / RequestAnimationFrame.js
Last active January 3, 2016 09:29 — forked from mrdoob/RequestAnimationFrame.js
Request Animation Frame
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@robmcalister
robmcalister / hold.js
Last active January 3, 2016 04:59
Tap and Hold directive for angularjs (rmHold).
app.directive('rmHold', ['$timeout', function($timeout) {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
var isActive = false;
var currentTimeout = null;
var startCoords = {
x: null,
y: null
}
import re
# Some mobile browsers which look like desktop browsers.
RE_MOBILE = re.compile(r"(iphone|ipod|blackberry|android|palm|windows\s+ce)", re.I)
RE_DESKTOP = re.compile(r"(windows|linux|os\s+[x9]|solaris|bsd)", re.I)
RE_BOT = re.compile(r"(spider|crawl|slurp|bot)")
def is_desktop(user_agent):
"""