Skip to content

Instantly share code, notes, and snippets.

@saranya-vatti
saranya-vatti / components.alerts\.js
Last active June 30, 2020 00:18
Approach 3 - Event Bus
import Component from '@glimmer/component';
import { action, get } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
export default class Filters extends Component {
@tracked filterValue;
constructor() {
@saranya-vatti
saranya-vatti / components.alerts\.js
Last active June 30, 2020 16:21
Approach2 - DataService
import Component from '@glimmer/component';
import { action, get } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
export default class Filters extends Component {
// get dataService() {
// const fullName = 'service:' + get(this.args, 'dataServiceName');
// return getOwner(this).lookup(fullName);
import Component from '@glimmer/component';
export default class Alerts extends Component {
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@saranya-vatti
saranya-vatti / controllers.application.js
Last active February 13, 2019 20:53 — forked from mike-north/controllers.application.js
EmberLearn - Ember.Object
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
let myCourse = Course.create();
myCourse.set('description', 'In this course, we\'ll learn about cats!');
alert(myCourse.languageName('js'));
@saranya-vatti
saranya-vatti / .jshintrc
Created August 31, 2018 07:16 — forked from insin/.jshintrc
Template for HTA / browser React apps
{
"browser": true,
"node": true,
"curly": true,
"devel": true,
"globals": {
"ActiveXObject": true,
"async": true,
"moment": true,
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t;
//Kindergarten addition
/**
* sum of two huge numbers
* @param {[string]} str1
* @param {[string]} str2
* @return {[string]} [sum]
*/
function sum(str1, str2) {
var carry = 0;
var result = "";
function merge(a, b) {
var c = new Array();
var k=0;
while(a.length || b.length) {
if(b.length == 0 || a[0]<=b[0]) {
c[k] = a.shift();
} else {
c[k] = b.shift();
}
k++;
@saranya-vatti
saranya-vatti / downloading_ebooks.py
Created August 4, 2015 18:37
Small code snippet in Python 3 to download epub files
##code to extract all the ebooks from http://inzania.com/temp/kindle/books/ and save it to a directory
try:
import urllib.request as urllib2
except:
import urllib2
import bs4
from bs4 import BeautifulSoup
destDir = 'E:\\Books\\New folder\\tmp\\'