Skip to content

Instantly share code, notes, and snippets.

View ritz078's full-sized avatar

Ritesh Kumar ritz078

View GitHub Profile
background: linear-gradient(270deg, #246655, #00fab9);
background-size: 400% 400%;
-webkit-animation: AnimationName 30s ease infinite;
-moz-animation: AnimationName 30s ease infinite;
-o-animation: AnimationName 30s ease infinite;
animation: AnimationName 30s ease infinite;
@-webkit-keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
git clone github.com/user/repository.git
# Clone repository
cd repository
#Create an orpan branch named "gh-pages"
git checkout --orphan gh-pages
#remove all files
git rm -rf .
@ritz078
ritz078 / main.js
Created March 24, 2015 08:12
Scroll to div animation
$('li>a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top-60
}, 200, 'swing', function () {
window.location.hash = target;
@ritz078
ritz078 / Grep.js
Last active August 29, 2015 14:27 — forked from nicdaCosta/Grep.js
Basic function that searches / filters any object or function and returns matched properties.
/*
Grep.js
Author : Nic da Costa ( @nic_daCosta )
Created : 2012/11/14
Version : 0.2
(c) Nic da Costa
License : MIT, GPL licenses
Overview:
Basic function that searches / filters any object or function and returns matched properties.
@ritz078
ritz078 / what-forces-layout.md
Last active September 19, 2015 06:16 — forked from paulirish/what-forces-layout.md
What forces layout/reflow in Chrome. 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()
var x = new EmbedJS({
element: document.getElementById('rawText')
});
x.render();
// Do
export default MyComponent extends React.Component{}
MyComponent.propTypes = {
name: React.PropType.string
}
// Don't
export default MyComponent extends React.Component{
static propTypes = {
name: React.PropType.string
This file has been truncated, but you can view the full file.
[{"pid":2159,"tid":1547,"ts":146345419103,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../components/scheduler/base/task_queue_impl.cc","src_func":"PushOntoImmediateIncomingQueueLocked"},"dur":4589,"tdur":1369,"tts":16506052},
{"pid":2159,"tid":1547,"ts":146345423552,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":70,"tdur":64,"tts":16507286},
{"pid":2159,"tid":1547,"ts":146345423626,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":11,"tdur":9,"tts":16507358},
{"pid":2159,"tid":1547,"ts":146345423640,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":21,"tdur":18,"tts":16507372},
{"pid":2159,"tid":1547,"ts":146345423664,"ph":"X","ca
@ritz078
ritz078 / rust-reserved.js
Created September 6, 2017 20:29
A list of reserved keywords in Rust Language.
module.exports = [
"as",
"use",
"extern crate",
"break",
"const",
"continue",
"crate",
"else",
"if",
/*
JSON-to-Go
by Matt Holt
https://github.com/mholt/json-to-go
A simple utility to translate JSON into a Go type definition.
*/
function jsonToGo(json, typename) {
let data;
let scope;