Skip to content

Instantly share code, notes, and snippets.

View ArunHub's full-sized avatar

Arun M ArunHub

View GitHub Profile
@ArunHub
ArunHub / alert the buttons text
Last active August 31, 2016 03:13
alert the buttons text
<div class="btns">
<p>Write JavaScript (using jQuery is fine) so that clicking on any button will cause an alert to popup with the text of the button that was clicked.</p>
<p>Make sure your solution is as efficient as possible even if there are a lot more <code>button.btn</code>'s added on the page. Do not use unnecessary event listeners.</p>
<button class="btn">c</button>
<button class="btn">l</button>
<button class="btn">o</button>
<button class="btn">s</button>
<button class="btn">e</button>
select.input-sm {
line-height: 20px;
}
.navbar-default{
background: none;
border: 0;
}
.navbar{
@ArunHub
ArunHub / family.scss
Created December 1, 2016 06:08
some unique sass mixins
/// Select all children from the first to `$num`.
/// @group with-arguments
/// @content [Write the style you want to apply to the children, and it will be added within the @content directive]
/// @param {number} $num - id of the child
@mixin first($num) {
&:nth-child(-n + #{$num}) {
@content;
}
}
@ArunHub
ArunHub / routeconfig.js
Created February 12, 2018 16:25
multilevel UI-view routes
.config(function ($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise("/home");
$stateProvider
//------------------------------
// HOME
//------------------------------
@ArunHub
ArunHub / breakStr.js
Created July 7, 2018 09:38
break string into array of strings whose length is given as input
function breakStr(string, count) {
//return [...string.slice(count - 1)].map((_, i) => string.slice(i, i + count));
return [Array.from(string).slice(count - 1)].map((_, i) => string.slice(i, i + count));
}
@ArunHub
ArunHub / binaryNum.js
Created July 7, 2018 09:41
converts as binary numbers and get 1's count also
function binary(n){
var stac = [];
while(n > 0){
remainder = n%2;
stac.push(remainder);
n = Math.floor(n/2);
}
console.log(stac.reverse())
var count = 0;
stac.forEach((t,i)=>{
@ArunHub
ArunHub / alert-buttons.html
Last active July 7, 2018 09:44
alert the buttons text //source https://jsbin.com/fawepetaha
<div class="btns">
<p>Write JavaScript (using jQuery is fine) so that clicking on any button will cause an alert to popup with the text of the button that was clicked.</p>
<p>Make sure your solution is as efficient as possible even if there are a lot more <code>button.btn</code>'s added on the page. Do not use unnecessary event listeners.</p>
<button class="btn">c</button>
<button class="btn">l</button>
<button class="btn">o</button>
<button class="btn">s</button>
<button class="btn">e</button>
@ArunHub
ArunHub / sass-architecture.txt
Created August 11, 2018 15:05
sass architecture to start for a project
sass/
|
|– abstracts/
| |– _variables.scss # Sass Variables
| |– _functions.scss # Sass Functions
| |– _mixins.scss # Sass Mixins
| |– _placeholders.scss # Sass Placeholders
|
|– base/
| |– _reset.scss # Reset/normalize
@ArunHub
ArunHub / _agents.scss
Created August 11, 2018 15:17
Last time i worked on bootstrap with scss
/*Agents list page */
.agents-listing {
&.grid-property {
p{
margin-top: 5px;
text-align: right;
}
@ArunHub
ArunHub / factorial.js
Created August 23, 2018 06:22
fatorial for given number
var factorial = function(n) {
if(n == 0) {
return 1
} else {
return n * factorial(n - 1);
}
}