Skip to content

Instantly share code, notes, and snippets.

View ConAntonakos's full-sized avatar
🏠
Working from home

Constantine Antonakos ConAntonakos

🏠
Working from home
View GitHub Profile
@arnaudbreton
arnaudbreton / async-process-jasmine.Spec.js
Last active August 29, 2015 14:00
The 5 best front-end developer tools blogpost: testing with Mocha and Jasmine
AsyncProcess = require('./async-process').AsyncProcess
describe('AsyncProcess', function() {
var asyncProcess;
beforeEach(function() {
asyncProcess = new AsyncProcess();
});
it('should process 42', function() {
@ianoxley
ianoxley / example.html.haml
Created August 15, 2011 20:06
Example code for my Introduction to Haml article on RubySource.com
!!! 5
%html
%head
%title Example HAML
/[if IE]
%link{ :rel => "stylesheet", :href => "/css/ie.css" }
%body
#container
%header
%h1 Our Awesome HTML5 Template
@malachaifrazier
malachaifrazier / application.html.erb
Created September 25, 2012 15:16
current_user.full_name shows method error because there is no user yet. Toss a conditional in there to fix all the things. if user_signed_in?
<!DOCTYPE html>
<html>
<head>
<title>Treebook</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="navbar navbar-fixed-top">
@mbostock
mbostock / .block
Last active February 9, 2016 01:52
Extending Arcs
license: gpl-3.0
@addyosmani
addyosmani / array.prototype.fill.js
Last active May 31, 2016 19:16
ES6 Array.prototype.fill() polyfill
if ( ![].fill) {
Array.prototype.fill = function( value ) {
var O = Object( this );
var len = parseInt( O.length, 10 );
var start = arguments[1];
var relativeStart = parseInt( start, 10 ) || 0;
var k = relativeStart < 0
? Math.max( len + relativeStart, 0)
: Math.min( relativeStart, len );
@chinchang
chinchang / react-with-unknown-attributes.js
Last active September 15, 2016 09:22
Make ReactJS work with unknown attributes
/**
*
* PATCH to make React work with custom attributes.
*
*/
HTMLDOMPropertyConfig.isCustomAttribute = function(attr) {
// Strip off custom attributes React puts for its working.
if ({children: 1}[attr]) { return false; }
// Take any attribute (with correct syntax) as custom attribute.
@kkoch986
kkoch986 / MultiSelect.jsx
Last active March 6, 2017 08:58
A MultiSelect prototype for Material UI (v.0.14.4)
/**
* Material UI multi select
*
* Use with:
* <MultiSelect fullWidth={true} value={this.state.values} onChange={(e,v) => this.setState({values: v})}>
* <ListItem primaryText={"Option 1"} value={1} />
* <ListItem primaryText={"Option 2"} value={2} />
* <ListItem primaryText={"Option 3"} value={3} />
* <ListItem primaryText={"Option 4"} value={4} />
* </MultiSelect>
@tkh44
tkh44 / async-component.js
Last active May 30, 2017 15:43
modified versions of @acdlite's async component. Uses async/await.
import { Component, createElement } from 'react'
export default function asyncComponent (getComponent) {
return class AsyncComponent extends Component {
static NextComponent = null;
state = { NextComponent: AsyncComponent.NextComponent }
componentWillMount = async () => {
if (this.state.NextComponent) {
return
@alexdiliberto
alexdiliberto / date_and_number_formatting.js
Created October 6, 2016 01:35
Vanilla JS date and number formatting
// "October 5, 2016"
(new Date()).toLocaleString('en-us', {month: 'long', day: 'numeric', year: 'numeric'});
new Intl.DateTimeFormat('en-US', { year: 'numeric', month: 'long', day: 'numeric' }).format(new Date())
// "$123.45"
Number(123.45).toLocaleString('en-us', { style: 'currency', currency: 'USD' });
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(123.45);
@juno
juno / using-ruby-1.9.3-p327.md
Created November 10, 2012 11:28
Using ruby-1.9.3-p327 with ruby-env and ruby-build

Using ruby-1.9.3-p327 with ruby-env and ruby-build

Prerequisite

  • Mac OS X Mountain Lion (10.8.2)
  • Homebrew
  • readline
  • rbenv

Install or update ruby-build