1. ES6 .includes()
:
var S = "fullweb";
S.includes("web");
2. RegExp .search()
:
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): | |
""" |
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 | |
} |
/** | |
* Provides requestAnimationFrame in a cross browser way. | |
* @author paulirish / http://paulirish.com/ | |
*/ | |
if ( !window.requestAnimationFrame ) { | |
window.requestAnimationFrame = ( function() { | |
return window.webkitRequestAnimationFrame || |
requirejs(['cordova.js'], | |
function () { | |
// start of require | |
// cordova is now available globally | |
var exec = cordova.require('cordova/exec'); | |
var app = { | |
// Application Constructor |
{ | |
"folders": | |
[ | |
{ | |
"path": "Leanpub/sublime-productivity", | |
"folder_exclude_patterns": ["epub_images", "convert_html", "preview", "published"], | |
"file_exclude_patterns": [".gitignore", "*.sublime*", "*Icon*"] | |
}, | |
{ | |
"path": "SublimeTextTips" |
public with sharing class ChatterUtils { | |
// makes a simple chatter text post to the specified user from the running user | |
public static void simpleTextPost(Id userId, String postText) { | |
ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile; | |
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput(); | |
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>(); | |
// Mocked Service | |
angular.module('mock.users', []). | |
factory('UserService', function($q) { | |
var userService = {}; | |
userService.get = function() { | |
return { | |
id: 8888, | |
name: "test user" | |
} |
<?php | |
$apnsHost = 'gateway.sandbox.push.apple.com'; | |
$apnsCert = 'apns-dev.pem'; | |
$apnsPort = 2195; | |
$streamContext = stream_context_create(); | |
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert); | |
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext); |