Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / Gruntfile.js
Last active December 9, 2015 22:38
grunt 0.4 file.expandMapping and templates
module.exports = function(grunt) {
grunt.initConfig({
stuff: {
dest: 'foo/',
ext: '.bar',
},
log_files: {
my_target: {
files: grunt.file.expandMapping('**/*.js', '<%= stuff.dest %>', {
@jeff-minard-ck
jeff-minard-ck / Vagrantfile
Created January 10, 2014 16:20
vagrant file with HD provisioning
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "2creatives-centos65-652"
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.2/centos65-x86_64-20131219.box"
config.vm.hostname = "mymachine.com"
config.vm.synced_folder "salt/root/", "/srv/"

Japanese translation from the original post in English.

原文: [Getting Literal With ES6 Template Strings by Addy Osmani] (http://updates.html5rocks.com/2015/01/ES6-Template-Strings)

#ES6のテンプレート文字列

従来のJavaScriptの文字列処理はPythonやRubyに比べて非力でしたが、ES6のテンプレート文字列はこの状況を根本的に覆します。(テンプレート文字列はChrome 41からサポートされています。)それによりプログラマはドメイン固有言語(domain-specific language、DSL)を定義する事が可能になります。以下はテンプレート文字列が提供する機能です。

  • 文字列の挿入
  • 式を文字列に埋め込む
@shimondoodkin
shimondoodkin / chat.js
Created November 14, 2012 13:22
nodejs express 3 integration of - socket.io with sessions and sessionid handshake
/**
* Module dependencies.
*/
var express = require('express')
// , routes = require('./routes')
// , user = require('./routes/user')
, http = require('http')
, path = require('path');
@auser
auser / app.js
Last active October 11, 2017 03:01
The complete source for the http://www.ng-newsletter.com/posts/chrome-apps-on-angular.html article. Enjoy!
angular.module('myApp', ['ngRoute'])
.provider('Weather', function() {
var apiKey = "";
this.getUrl = function(type, ext) {
return "http://api.wunderground.com/api/" +
this.apiKey + "/" + type + "/q/" +
ext + '.json';
};
@PaulKinlan
PaulKinlan / manifest-polyfill.html
Last active February 27, 2018 17:49
Web App Manifest Polyfill for iOS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="manifest" href="https://jsbin-user-assets.s3.amazonaws.com/kinlan/manifest.json">
<title>iOS Manifest Polyfill</title>
</head>
<body>
@andyedinborough
andyedinborough / jquery.oauth.js
Created June 7, 2011 19:30
Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()
(function (window, document, $, undefined) {
if (!$.Deferred) throw 'jQuery 1.5 is required to use the jQuery.oauth script!';
function require(name, url) {
if (window[name] === undefined)
return $.ajax({ type: 'GET', cache: true, dataType: 'script', url: url });
}
$.oauth = function (options) {
var d = $.Deferred();
@addyosmani
addyosmani / pwas.md
Last active June 10, 2020 18:30
💄💋 Progressive Web Apps across popular frameworks that I have written or contributed significantly to

React HN (Universal rendering, Offline caching, optimisations)

React + Webpack application using the PRPL pattern

@mdaniel
mdaniel / Vagrantfile
Last active February 21, 2021 10:30
Provision a virtual machine for building ChromeOS using Vagrant <http://www.vagrantup.com>. Just download this into a directory, name it ``Vagrantfile`` (if it isn't already), run ``vagrant up`` followed by ``vagrant ssh`` and you'll see two shell scripts there, ready to sync up the ChromeOS source code.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu1204_64"
@hackerwins
hackerwins / SortedMap.ts
Created June 26, 2018 01:37
SortedMap using LLRB Tree.
/**
* Implementation of an SortedMap using Left-leaning Red-Black Tree
*
* Original paper on Left-leaning Red-Black Trees:
* - http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf
*
* Invariant 1: No red node has a red child
* Invariant 2: Every leaf path has the same number of black nodes
* Invariant 3: Only the left child can be red (left leaning)
*/