This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import os | |
>>> programa = r'C:\Program Files (x86)\mongoDB\bin\mongod.exe' | |
>>> parametros = r'--logpath "C:\Foo\Bar\Base\install.log" --dbpath "C:\Foo\Bar\Base\data\db" --port 1124' | |
>>> os.path.dirname(programa) | |
'C:\\Program Files (x86)\\mongoDB\\bin' | |
>>> os.path.basename(programa) | |
'mongod.exe' | |
>>> os.spawnl(os.P_WAIT, os.path.dirname(programa), os.path.basename(programa), parametros) | |
Traceback (most recent call last): | |
File "<pyshell#20>", line 1, in <module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The JavaScript implementation of the Secure Hash Algorithm 1 | |
* | |
* Copyright (c) 2008 Takanori Ishikawa <takanori.ishikawa@gmail.com> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: iso-8859-15 -*- | |
import Tkinter as tkinter | |
import urllib2, urllib | |
import json | |
TRANSLATE_URL = 'http://ajax.googleapis.com/ajax/services/language/translate' | |
TO_ENGLISH = 'fr|en' | |
TO_FRENCH = 'en|fr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TinyORM = (function(options) { | |
/* a hash containing all the available models */ | |
var Models = {}; | |
var connection = null; | |
var config = _.extend({ | |
/* The name of the database which Ti will open. The local db is located at: | |
~/Library/Application Support/iPhone Simulator/4.2/Applications/APP_ID/Library/Application Support/database/dbname | |
*/ | |
dbname: 'add.db', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Program execution context" | |
import warnings | |
class SwizzleContext(object): | |
"""Type switching context object base class | |
Supports the context manager protocol to switch the instance from a | |
MutableContext to the protected Context. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Superseeded: https://gist.github.com/devinrhode2/4705947 | |
/** | |
* Keep a histroy array of console log's | |
* See example at bottom | |
*/ | |
window.originalConsole = window.console; | |
window.originalLog = window.console.log; | |
window.logWithHistory = function logWithHistoryFn() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' expressionString = IF Variable_3 > 1000 RETURN VARIABLE_3* VARIABLE_1 END IF Variable_3 < 1000 RETURN VARIABLE_3* VARIABLE_2 END ''' | |
def parse_expression(expressionString): | |
expressionStringArray = filter(None,expressionString.split("END")) | |
''' expressionStringArray[0] = IF Variable_3 > 1000 RETURN VARIABLE_3* VARIABLE_1 | |
expressionStringArray[1] = IF Variable_3 < 1000 RETURN VARIABLE_3* VARIABLE_2 ''' | |
for expression in expressionStringArray: | |
expConditionResult = expression.strip().split("RETURN") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SalesOrder.prototype.decorate = function(decorator) { | |
var override | |
for (override in decorator) { | |
if (decorator.hasOwnProperty(override)) { | |
var oldfunc = this[override] | |
var decfunc = decorator[override] | |
var newfunc = function() { | |
var args = Array.prototype.slice.call(arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frappe.ui.form.on("Quotation", "refresh", function(frm, doctype, name) { | |
cur_frm.add_custom_button(__('Add Interaction'), function() { | |
var d = frappe.prompt([ | |
{label:__("Type of Interaction"), fieldtype:"Select", | |
options: ["SMS", "Call", "Visit", "Webex"], | |
fieldname:"type_of_interaction"}, | |
{label:__("Result"), fieldtype:"Select", options: ["Status Quo", "Warmer", "Colder"], fieldname:"result"}, | |
{fieldtype: "Column Break"}, | |
{'fieldname': 'responce_reson', 'fieldtype': 'Data', 'label': 'Responce Reson', 'reqd': 0}, | |
{'fieldname': 'next_date', 'fieldtype': 'Date', 'label': 'Next Action Date', 'reqd': 0}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to define: | |
// -------------- | |
var callableObjectFn = function() { | |
// Use CallableObject as name in constructor function, but also when setting property below. | |
var CallableObject = (function(CallableObject) { | |
return function() { | |
return CallableObject(); | |
}; | |
}(callableObjectFn)); | |
CallableObject.property = 'value'; |
OlderNewer