Skip to content

Instantly share code, notes, and snippets.

View waghcwb's full-sized avatar
🎧
‌‌

Wagner Souza waghcwb

🎧
‌‌
View GitHub Profile
@BaseCase
BaseCase / gist:2139106
Created March 20, 2012 18:17
A sample Cakefile
{exec} = require 'child_process'
task 'test', 'Runs all Jasmine specs in spec/ folder', ->
test()
task 'compile', 'Compiles coffee in src/ to js in bin/', ->
compile()
task 'stitch', 'Stitches all app .js files', ->
@monokrome
monokrome / interfaces.coffee
Last active January 9, 2018 15:00
Interfaces in CoffeeScript
class Host
constructor: ->
interfaces = @constructor.interfaces
if interfaces?
for interface in interfaces
_.extend @, interfaces
@implements: (host, interface) ->
# This effectively makes host optional
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin';
import PACKAGE from './package.json';
const banner = PACKAGE.name + ' - ' + PACKAGE.version + ' | ' +
'(c) 2016, ' + new Date().getFullYear() + ' ' + PACKAGE.author + ' | ' +
PACKAGE.license + ' | ' +
@tmpvar
tmpvar / managing-dependencies.md
Last active October 17, 2018 00:20
using modules in your new nodejs module

Managing dependencies

Ok, so you've built your first module, but now you want to make it use one of the many libraries available via the npm registry.

finding modules

There are a few ways to find a module. You can use http://npmjs.org or http://npmsearch.com to find modules that may fit what you need.

some advice for choosing modules

@mattheath
mattheath / publicize-coderwall-membership.rb
Created April 12, 2013 02:36
Publicize membership of Coderwall organisations
require "github_api"
user = ''
token = ''
github = Github.new oauth_token: token
coderwall_orgs = []
github.orgs.list.each do |org|
coderwall_orgs << org.login if org.login =~ /^coderwall/
@GracjanZwr
GracjanZwr / node.md
Last active June 15, 2019 12:52
installing nodejs in Kali Linux
@TakayoshiKochi
TakayoshiKochi / Custom-Elements-in-Imports.md
Last active September 3, 2019 13:58
CEv1 in classic HTML Imports

Custom Elements V1 in HTML Imports

This document describes how custom elements v1 work when they are defined or used in HTML Imports.

HTML Imports is currently implemented only in Chrome, and this document provides non-normative information about Chrome's implementation in M54 and later, for the reference of future works that tries to achieve similar functionality like HTML Imports.

Defining Custom Element in an imported document

As the global context window is shared with script running in an imported document, you can access the custom elements registry via window.customElements. This is straightforward and no different from the usage in a usual HTML document.

/**
* range()
*
* Returns an array of numbers between a start number and an end number incremented
* sequentially by a fixed number(step), beginning with either the start number or
* the end number depending on which is greater.
*
* @param {number} start (Required: The start number.)
* @param {number} end (Required: The end number. If end is less than start,
* then the range begins with end instead of start and decrements instead of increment.)
@camille-hdl
camille-hdl / es6-throttle.js
Last active September 3, 2020 09:29
Function throttling implementation in ES6
/*
http://www.es6fiddle.net/i8d8e1um/
*/
var throttle = (func,ms=50,context=window) => {
let to;
let wait=false;
return (...args) => {
let later = () => {
func.apply(context,args);
};
@cannium
cannium / aes-256-gcm.go
Last active May 9, 2021 20:19
golang aes-256-gcm
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)