Skip to content

Instantly share code, notes, and snippets.

View sashadev-sky's full-sized avatar

sashadev-sky

  • New York, NY
View GitHub Profile
@sashadev-sky
sashadev-sky / .gitignore
Created November 28, 2018 22:13
Gitignore reference
# Comprehensive sample .gitignore file for reference
#############################################
# compiled from github.com/github/gitignore #
#############################################
### Custom ###
*.db
*.sqlite
@sashadev-sky
sashadev-sky / gist:2e5dd651f4a0894aa47b1c3d8a4e0e43
Created December 10, 2018 17:37
The Life-Cycle of a Composite Component
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount()
* - render()
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount()
@sashadev-sky
sashadev-sky / wrapper.js
Last active February 20, 2019 09:44
Node script to wrap a React component
import { Conversation } from 'chat-template';
import ReactDOM from 'react-dom';
import React from 'react';
const showChatTemplate = (messages, element, delay = 1, height = 300) => {
ReactDOM.render(<Conversation delay={delay} height={height} messages={messages} />,
element);
};
module.exports = showChatTemplate;
@sashadev-sky
sashadev-sky / example.js
Created February 21, 2019 03:22
Conversion of Hex to Two's Compliment
// Conversion to Two's Complement
//Note that this works both ways. If you have -30, and want to represent it in 2's complement,
// take the binary representation of 30:
0000 0000 0000 0000 0000 0000 0001 1110
// Invert the digits.
@sashadev-sky
sashadev-sky / gist:dd5c430654dd69c4ba5f295a1e8a0c44
Created June 10, 2019 20:12
L.DomEvent extended touch support for IE and Windows
import * as DomEvent from './DomEvent';
import * as Util from '../core/Util';
import * as Browser from '../core/Browser';
/*
* Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
*/
var POINTER_DOWN = Browser.msPointer ? 'MSPointerDown' : 'pointerdown';
@sashadev-sky
sashadev-sky / fork forced sync
Created September 27, 2019 13:43 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
@sashadev-sky
sashadev-sky / fork forced sync
Created September 27, 2019 13:43 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
$ ls -lah
$ sudo chown -R <username> <directory_name>
refile problem - need to use downgraded bundler version to install gems
```Bash
$ gem install bundler -v 2.0.1
$ bundle _2.0.1_ install
```
## Rendering with status and location headers:
All renders take the :status and :location options and turn them into headers. They can even be used together:
```Ruby
render :xml => post.to_xml, :status => :created, :location => post_url(post)
```
Note that the :status option accepts not only an HTTP status code (such as 500),
but also a symbol representing that code (such as :created), if that makes more sense to you.