Skip to content

Instantly share code, notes, and snippets.

@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@dandelany
dandelany / gist:1ff06f4fa1f8d6f89c5e
Last active March 27, 2024 10:06
Recursively cloning React children
var RecursiveChildComponent = React.createClass({
render() {
return <div>
{this.recursiveCloneChildren(this.props.children)}
</div>
},
recursiveCloneChildren(children) {
return React.Children.map(children, child => {
if(!_.isObject(child)) return child;
var childProps = {someNew: "propToAdd"};
@tbranyen
tbranyen / _usage.md
Last active April 19, 2024 12:24
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@ericlbarnes
ericlbarnes / bower.json
Last active January 8, 2024 01:52
Gulp, Bower, Bootstrap Sass, FontAwesome
{
"name": "project",
"version": "0.0.0",
"authors": [
"Eric Barnes <me@example.org>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
@etiennetalbot
etiennetalbot / App.Module.js
Last active August 31, 2016 06:34
Javascript Module
/*jslint nomen: true */
window.App = window.App || {};
window.App.ModuleName = (function (document, $) {
'use strict'; //OPTIONAL if you don't want your code to be strict
var _vars, _els, _privateMethod, init;
@ursuleacv
ursuleacv / gist:20ac531649f76f123ca6
Last active August 31, 2016 06:09
JavaScript modules
//Object Literal
var app = app || {};
//object literal
app = {
init: function(){
this.cache();
this.bind();
},
@Jelby-John
Jelby-John / glyphicons.files.css
Last active December 22, 2017 15:02
Glyphicons Pro in Twitter Bootstrap 3
@font-face { font-family: 'Glyphicons files'; src: url('../fonts/glyphicons-filetypes-regular.eot'); src: url('../fonts/glyphicons-filetypes-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-filetypes-regular.woff') format('woff'), url('../fonts/glyphicons-filetypes-regular.ttf') format('truetype'), url('../fonts/glyphicons-filetypes-regular.svg#glyphicons-filetypes-regular') format('svg'); } .glyphfiles { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons files'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }.glyphfiles-txt:before {content: "\e001"; }.glyphfiles-doc:before {content: "\e002"; }.glyphfiles-rtf:before {content: "\e003"; }.glyphfiles-log:before {content: "\e004"; }.glyphfiles-tex:before {content: "\e005"; }.glyphfiles-msg:before {content: "\e006"; }.glyphfiles-text:before {content: "\e007"; }.glyphfiles-wpd:before {content: "\e008"; }.glyphfiles-wps:before {con
@mpmckenna8
mpmckenna8 / brazilWor.json
Last active April 11, 2022 03:18
d3 data() to load brazil w/ cities map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
rbenv install 1.9.3-p392