Skip to content

Instantly share code, notes, and snippets.

View amarkanala's full-sized avatar
🎯
Focusing

amarender kanala amarkanala

🎯
Focusing
View GitHub Profile
@amarkanala
amarkanala / jsVariablename.js
Last active December 17, 2023 00:37
Get "variable" name as a string in JavaScript
const carColor = "red"
// will use the shorthand notation to create an object and get the first element of the keys array
const [carColorVaribale] = Object.keys({carColor})
const log = `Variable ${carColorVaribale} has an value of ${carColor}`
// "Variable carColor has an value of red"
@amarkanala
amarkanala / LICENSE.txt
Last active December 31, 2018 23:10 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@amarkanala
amarkanala / magic.py
Last active December 12, 2016 03:15
magic function
def magic(n):
units = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine "]
teens = ["", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
thousands = ["","thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "quattuordecillion", "sexdecillion", "septendecillion", "octodecillion", "novemdecillion", "vigintillion "]
words = []
wordLength = 0
if n < 0:
return wordLength
@amarkanala
amarkanala / tmux-cheatsheet.markdown
Created October 12, 2016 17:23 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@amarkanala
amarkanala / what-forces-layout.md
Created September 28, 2015 21:58 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@amarkanala
amarkanala / gist:5b251eb98d3edfb3f9e2
Created September 25, 2015 07:20 — forked from ynechaev/gist:8123871
UIView 3d transform animation style: horizontal flip
UIView *myView = cell.containerView;
CALayer *layer = myView.layer;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0 / -1000;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, M_PI / 0.3, 0.0f, 1.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
[UIView animateWithDuration:1.0 animations:^{
layer.transform = CATransform3DIdentity;
}];
@amarkanala
amarkanala / custom-html-and-js-in-ghost-js.html
Last active September 17, 2015 17:57 — forked from puttyman/custom-html-and-js-in-ghost-js.html
GhostJS - How to use external JavaScript libraries with custom HTML markup on your ghost blog platform
<form class="tw-bs form-inline">
<div class="form-group">
<label class="sr-only" for="weight">Weight (in killograms)</label>
<div class="input-group">
<input type="number" class="text-right form-control" id="weight" placeholder="Weight" value="80">
<div class="input-group-addon">Kgs</div>
</div>
</div>
</form>
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

//BOUNCE ANIMATION
-(void)beginBounceAnimation {
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
self.view.alpha = 1.0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.25];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)];
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
[UIView commitAnimations];
#import <UIKit/UIKit.h>
@interface BouncyButtonViewController : UIViewController
@end