Skip to content

Instantly share code, notes, and snippets.

View Avinashachu007's full-sized avatar

Avinash Avinashachu007

  • Chennai, India
View GitHub Profile
@Avinashachu007
Avinashachu007 / indianCurrency.js
Last active February 22, 2017 11:28
A library to handle Currencies in JavaScript. By default, It will handle Indian Currency. Change 'Currency.prototype.locale' & 'Currency.prototype.currency' to Handle whatever currency of your wish
Number.prototype.toCurrency = function(){ // Prototype Added to Number property to convert Number into Currncy Object
return new Currency(this.valueOf());
};
function Currency(args){ //Important: Currency Object Constructor
this.value = args*Currency.prototype.multiple;
return this.value;
}
Currency.prototype.multiple = 1000; // Currency is always in paisa. If u want accuracy of two digit after decimal set it 100; For three digit accuracy set into 1000
Currency.prototype.locale = 'en-IN'; // Currency should be Displayed in Indian Currency format '1,10,00,000'(Crores,Lakhs,Thousands)
Currency.prototype.currency = 'INR'; // Symbol shown before the amount
@paulochf
paulochf / countries.sql
Last active November 27, 2023 15:41 — forked from adhipg/countries.sql
Outdated. Used with discretion. Accepting updates.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@kazad
kazad / fourier.html
Created June 25, 2014 19:00
BetterExplained Fourier Example
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="//ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<!--
TODO:
@MattSurabian
MattSurabian / JS Quiz Answer Explanations.md
Last active October 11, 2023 19:38
My attempt to explain the answers for David Shariff's feelings hurting JS quiz found at: davidshariff.com/js-quiz/

Are your feelings hurt?

If you rushed through David Shariff's JS Quiz or are just new to JS they might be. I know mine were. After I dried my eyes, I took the quiz again, this time very slowly trying to get at the meat behind each answer. Below is my attempt to explain each question's answer and offer some interesting permutations so that others can move beyond their hurt feelings and come out the other side better JS developers.

I initially thought I'd turn this into a blog post but think it's probably better as a gist.

Question #1

Don't over think it.

var foo = function foo() {
@elclanrs
elclanrs / money.js
Created January 10, 2014 17:25
Working with money in JS using integers instead of floating point
var Money = (function(){
function Money(qty) {
this.whole = 0;
this.cents = 0;
this.add(qty);
}
Money.prototype.calc = function() {
while (this.cents > 100) {
this.cents -= 100;
this.whole += 1;
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@HarishChaudhari
HarishChaudhari / country-code-to-currency-code-mapping.csv
Last active April 20, 2024 18:54
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {