Skip to content

Instantly share code, notes, and snippets.

View shivakumaravula's full-sized avatar

Shiva Kumar Avula shivakumaravula

View GitHub Profile
@shivakumaravula
shivakumaravula / wishlist delete script
Created August 12, 2020 19:06 — forked from srikanth4b9/wishlist delete script
FlipKart Wishlist delete
$("body").delegate(".fk-item-wl-link", "mouseover", function() {
window.removeList = window.removeList || [];
var list = window.removeList;
var index = list.indexOf(this);
var $this = $(this);
if (index === -1) {
list.push(this);
$this.append('- Added to remove list');
} else {
list.splice(index, 1);
//************************************************
//
// Catmull-Rom Spline to Bezier Spline Converter
//
//
// This is an experimental extension of the SVG 'path' element syntax to
// allow Catmull-Rom splines, which differs from Bézier curves in that all
// defined points on a Catmull-Rom spline are on the path itself.
//
// This is intended to serve as a proof-of-concept toward inclusion of a
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
# (This is CoffeeScript. The compiled JavaScript is below.)
# Pull to Refresh in a TableView on Appcelerator Titanium
# Create an instance of the PullToRefresh class and set it as the table's pullView
# This class is based on code from http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
# Appcelerator Titanium SDK version 2.1.0.GA, tested only with iOS
class PullToRefresh
constructor: ->
@render()

If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.

Well, you can:

var _ = require((typeof ENV_TEST === 'boolean') ? 'alloy' : 'underscore')._;

The above works by utilizing Alloy's optimization process. In this process, constants like ENV_TEST will be either TRUE or FALSE. The actual expressions in wich they are used will then be evaluated. If FALSE the code block will be removed. In plain Titanium projects the constants are undefined and this typeof ENV_TEST will be undefined, so the code block will be executed.