Skip to content

Instantly share code, notes, and snippets.

// Underscore.js 1.2.1
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function() {
Template = {
settings: {
//evaluate: /\{\{([\s\S]+?)\}\}/g,
//interpolate: /\{\{=([\s\S]+?)\}\}/g,
// SYNC UnderScore
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
//
encode: /\{\{!([\s\S]+?)\}\}/g,
use: /\{\{#([\s\S]+?)\}\}/g,
@lomadurov
lomadurov / nodejs_global.js
Last active December 17, 2015 14:09
Node.js global scope
/**
* Loads a module.
* See {@link http://nodejs.org/api/modules.html} for more information.
* @param {String} moduleName
* @returns {*}
*/
function require(moduleName) {}
/**
* Use the internal <i><code>require()</code></i> machinery to look up the location of a module,
@lomadurov
lomadurov / lmd.scope.js
Last active December 17, 2015 14:19
LMD js scope http://lmdjs.org/
/**
*
* @param {String} moduleName module name or path to file
*/
function require(moduleName) {}
/**
* Matches in-package modules
*
* @param {RegExp} regExp
$.post('articles', {title: 'title', text: 'text'}, 'json').done(function(response){
var article = response.data;
self.articles.push(article);
}).fail(function(e, ){
switch(e.status){
case 422:
var messages = response.responseText;
// Обработать ошибку валидации и вывести сообщения
default:
// Обработать ошибку сервера или соединения
USE [master]
GO
/****** Object: StoredProcedure [dbo].[sp_dboption] Script Date: 21.03.2012 7:33:37 ******/
SET ANSI_NULLS ON
GO
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: webrtc2sip
# Required-Start: $syslog $network $local_fs $remote_fs $time
# Required-Stop: $syslog $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the webrtc2sip SIP and Media Gateway
# Description: Start and stop the webrtc2sip SIP and Media Gateway
{
"dependencies": {
"jquery": {
"version": "~1.11.0",
"homepage": "http://jquery.com/",
"development": {"js": "dist/jquery.js"},
"production": {"js": "dist/jquery.min.js"},
"sdn": "//yandex.st/jquery/1.11.0/jquery.min.js",
"pack": false,
"shortcuts": "jQuery"
if(preg_match_all('/<a href="([^"]+)"><img class="c_img" src="([^"]+\.gif)"><\/a>/Us', $comment['comment_desc'], $matches)
|| preg_match_all('/<a href="([^"]+)"><img class="b-image" src="([^"]+\.gif)"><\/a>/Us', $comment['comment_desc'], $matches)) {
<?php
function basename_real($file)
{
$f = parse_url($file);
return basename($f['path']);
}
$exts = array("gif","jpg","png","jpeg");
$url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ-ZVGZex9dyrwByXjAQ2cgE0VwH9CCitYhtSUC0pndN7iQwK1r';
$suff = @explode('.',basename_real($url));