Skip to content

Instantly share code, notes, and snippets.

@puiutucutu
puiutucutu / Array.prototype.compare.js
Created August 18, 2017 14:07 — forked from ain/Array.prototype.compare.js
JavaScript compare() method for Array
Array.prototype.compare = function(array) {
if (!array) {
return false;
}
if (this.length !== array.length) {
return false;
}
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] instanceof Array && array[i] instanceof Array) {
if (!this[i].compare(array[i])) {
@puiutucutu
puiutucutu / readme.md
Created August 3, 2017 03:18
Getting Foundation 6.4.1 to play nice with Palantir Blueprint 1.24.0

Steps

  1. In order to import blueprint.scss like @import "~@blueprintjs/core/src/blueprint";
    • need to install bourbon via npm install bourbon@4.3.2 --save as of Palantir Blueprint 1.24.0
  2. Foundation and Palantir Blueprint both use scss variables $switch-height and $switch-height-large and will result in a conflict when compiling the scss files. The solution involves resetting the variables to zero after loading Foundation but before loading Blueprint.
  3. Must manually specify the icon font path since relative path breaks when you import blueprint.scss in your application
    • do this with $icon-font-path: "~@blueprintjs/core/resources/icons";
@puiutucutu
puiutucutu / classes-example.js
Created July 27, 2017 15:38
Blueprint with classNames and Blueprint Classes
import classNames from 'classnames'
import { Classes, Intent } from '@blueprintjs/core'
render() {
let classes
// method one
classes = classNames('pt-tag','pt-large', {
[Classes.INTENT_DANGER]: daysElapsed > 7,
})
@puiutucutu
puiutucutu / 0_reuse_code.js
Created April 26, 2017 04:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@puiutucutu
puiutucutu / DropdownMenu.jsx
Created March 2, 2017 15:51 — forked from zackperdue/DropdownMenu.jsx
ReactJS Dropdown Menu with optgroup
import React from 'react';
var SelectInput = React.createClass({
propTypes: {
groupBy: React.PropTypes.string,
options: React.PropTypes.array.isRequired,
placeholder: React.PropTypes.string,
selected: React.PropTypes.string
},
@puiutucutu
puiutucutu / more-on-binary.md
Last active March 7, 2023 13:18
MSSQL Snippets

Binary (base2), Hexadecimal (base16), and base64

In PHP, say we have the following:

$sampleImageBase64 = 'R0lGODlhGQAZAPAAAO0cJAAAACH5BAAAAAAALAAAAAAZABkAAAIXhI+py+0Po5y02ouz3rz7D4biSJamWAAAOw==';
$sampleImageBinary = base64_decode($sampleImageBase64);
$sampleImageHexadecimal = bin2hex($sampleImageBinary);
@puiutucutu
puiutucutu / sticky.html
Created September 10, 2016 23:14
Foundation 6 sticky top bar
<div class="column row" data-sticky-container>
<div class="title-bar" data-sticky data-sticky-on="small" data-margin-top="0">
<p>Place the pickles in a wok, and decorate tenderly with shredded gravy. Place the pickles in a wok, and decorate tenderly with shredded gravy. Place the pickles in a wok, and decorate tenderly with shredded gravy.</p>
<div class="title-bar-left"></div>
<div class="title-bar-right"> </div>
</div>
</div>
@puiutucutu
puiutucutu / details.js
Last active September 8, 2016 13:09
Foundation 6 Abide cleanup with named attributes and dataset interfaces
// check if form element has attributes using getNamedItem() on the attributes interface
if (trailerDetailsFormSection['type'].attributes.getNamedItem('required')) {
// remove named attribute also using the attributes interface via removeNamedItem();
trailerDetailsFormSection['type'].attributes.removeNamedItem('required');
}
// ... and is equivalent to running
// see https://lists.w3.org/Archives/Public/www-dom/2001JanMar/0094.html for explanation
trailerDetailsFormSection['type'].removeAttribute('required');
@puiutucutu
puiutucutu / design-patterns-Understood.md
Last active September 14, 2016 14:52
Design Patterns Understood

Behavioral

Structural

Pattern Understood
Adapter / Wrapper
Bridge
Composite
Data Mapper
Decorator