Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

(ns helloworld.handler
(:use compojure.core)
(:require [clojure.java.io :as io]
[ring.util.response :as response]
[compojure.handler :as handler]
[compojure.route :as route]
[hiccup.form :as form]
[hiccup.core :refer [html]]))
;; ページレイアウト
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@underhilllabs
underhilllabs / app.js
Created September 1, 2014 18:56 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@underhilllabs
underhilllabs / example_controller.php
Last active December 27, 2015 00:19
Example CodeIgniter Controller that gets parameters back from a stored procedure.
<?php
class Example_controller extends CI_Controller {
// …
// Others attributes and methods omitted for brevity
/*
* Unfortunatelly, CodeIgniter does not work well with Stored Procedure with returning parameters,
* so, if you want to use any kind of Stored Procedure with parameters, it's better do it mannualy.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bash Command Visualization</title>
<style type="text/css">
* { margin: 0; padding: 0; }
#chart {
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname