Skip to content

Instantly share code, notes, and snippets.

@veereshmeesala
veereshmeesala / karma.config.js
Last active May 6, 2018 07:03
Webpack + Mocha + Chai
var webpackConfig = require('./webpack.config');
webpackConfig.devtool = 'inline-source-map';
module.exports = function (config) {
config.set({
browsers: [ 'PhantomJS' ],
singleRun: true,
frameworks: [ 'mocha', 'chai', 'sinon', 'sinon-chai' ],
files: [
'*/*.spec.js'
@pjstadig
pjstadig / core.clj
Created March 20, 2017 13:06
A little type hint hint
(ns typehint.core)
;; A little type hint hint...
(set! *warn-on-reflection* true)
;; There are two ways to type hint the return value of a function, but one is
;; (technically) wrong:
(defn ^String as-string0
@ejwinter
ejwinter / ExcelToTable.java
Last active August 10, 2023 02:39
Turn an Excel (xlsx) file with a single table in it into a Guava table with a header indexed
/**
* This class takes an Excel spreadsheet and converts it into a Guava Table format.
* When other formats of the file are to be supported (like CSV, TSV etc.,) implement the apply method with that format.
*/
@Component
public class ExcelToTableLoader implements TableGenerator<File> {
private static final Logger logger = org.slf4j.LoggerFactory.getLogger(ExcelToTableLoader.class);
@dmikurube
dmikurube / FlexmarkExamples.java
Created March 2, 2017 14:58
flexmark-java examples
import java.util.Arrays;
import com.vladsch.flexmark.ast.Node;
import com.vladsch.flexmark.ast.NodeVisitor;
import com.vladsch.flexmark.ast.Text;
import com.vladsch.flexmark.ast.VisitHandler;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.parser.ParserEmulationProfile;
import com.vladsch.flexmark.util.options.MutableDataHolder;
@iamaziz
iamaziz / weather.html
Last active December 3, 2022 12:11
Open Weather Map API.
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
<title>Weather API</title>
<!-- to be in a script.js -->
<script type="text/javascript">
@travisjeffery
travisjeffery / functional-options.md
Last active April 23, 2023 11:13
How to do functional options in Golang

Here's the simplest example showing how to do functional options in Golang.

They're a great way to enable users to set options and ease adding new options later.

package main

import (
	"flag"
	"fmt"
@ajdavis
ajdavis / watcher.py
Created January 4, 2017 13:14
Script based on the Python "watchdog" module to run tasks when files change.
#!/usr/bin/env python
import os
import re
import threading
import time
import subprocess
from os.path import splitext, expanduser, normpath
import click

微信小程序模块化开发实践

准备

@odrotbohm
odrotbohm / LambdaTypeDetectionSample.java
Last active January 28, 2023 09:54
Lambda type detection sample
public class LambdaTypeDetectionSample {
public static void main(String[] args) {
Function<Integer, String> lambdaFunction = i -> i.toString();
Function<Integer, String> oldschoolFunction = new Function<Integer, String>() {
public String apply(Integer t) {
return t.toString();
}
@simonw
simonw / wget.md
Created December 9, 2016 06:38
Recursive wget ignoring robots
$ wget -e robots=off -r -np 'http://example.com/folder/'
  • -e robots=off causes it to ignore robots.txt for that domain
  • -r makes it recursive
  • -np = no parents, so it doesn't follow links up to the parent folder