Python has a synthax to chain comparison operators. For example:
if x > y > z:
print('foo')
if x < y < z:
print('bar')
if x == y == z:
Python has a synthax to chain comparison operators. For example:
if x > y > z:
print('foo')
if x < y < z:
print('bar')
if x == y == z:
The most simple usage is as follows:
$ replace.py 'foobarz' 'foo bar' myfile.txt
The tool searches for foobarz
on the contents of myfile.txt and replaces it with foo bar
.
The result is written on stdout. This is useful to check if the script is doing what you expect.
If you want the tool to change de file itself, use the -I
argument
(use backups or versioning to avoid losing data):
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
namespace WebClientMultipartExtension | |
{ | |
public class MultipartFormBuilder | |
{ | |
static readonly string MultipartContentType = "multipart/form-data; boundary="; |
public class MyProfiler | |
{ | |
public int Calls | |
{ | |
get; | |
private set; | |
} | |
public TimeSpan TotalTime | |
{ |
from django.db import models | |
class djobjclone(object): | |
""" | |
Makes a clone of a django model object. | |
The clone is shallow and handicapped. | |
""" | |
def __init__(self, o): | |
assert isinstance(o, models.Model) |
(function (Array) { | |
var isFunction = function (value) { | |
var getType = {}; | |
return value && getType.toString.call(value) === '[object Function]'; | |
}; | |
var anyItemMeetsPredicate = function (items, predicate) { | |
for (var i=0; i < items.length; i++) { | |
if (predicate(items[i]) === true) { |
$('.typeahead').typeahead({
source: MYDATA
// Typeahead will not select the first suggestion.
// If the user press enter without selecting any suggestion
// the onselect function will be called with the inputted text