Skip to content

Instantly share code, notes, and snippets.

@wk-j
wk-j / Candidate.md
Last active October 18, 2015 08:54 — forked from apirak/Candidate.md

#Geeky Pod

##Checkin

####Python

  • Chaiwat Suttipongsakul
  • Chokchai Phatharamalai <<
  • Airmee Chanita Anuwong
  • Pam Suebvisai
  • Edkung Foo
#atom-perspective() {
@viewing-distance: 12in;
@rotation: 20deg;
.tree-view-scroller {
transform: translateY(-10vh) perspective(@viewing-distance) rotateY(@rotation);
padding-top: 12vh;
padding-bottom: 12vh;
transform-origin: left;
@wk-j
wk-j / gist:65c9d92a5e78e461e82e
Created October 21, 2015 06:33 — forked from forki/gist:08d36d1e79603ef12c25
Get Paket download counts
//------------------------------------------
// Step 0. Boilerplate to get the paket.exe tool
open System
open System.IO
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
let url = "http://fsprojects.github.io/Paket/stable"
@wk-j
wk-j / AspectExample.java
Created November 1, 2015 09:30 — forked from jpotts/AspectExample.java
Creating aspect-defined properties in CMIS with Alfresco
package com.someco.cmis.examples;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.chemistry.opencmis.client.api.Document;
@wk-j
wk-j / addSecondaryType.java
Created November 8, 2015 06:16 — forked from jpotts/addSecondaryType.java
Adding an aspect (known in CMIS 1.1 as a "secondary type") by modifying cmis:secondaryObjectTypeIds. This requires that you connect using the CMIS 1.1 service URL. You do not need the Alfresco OpenCMIS Extension when using this approach. Works with Alfresco 4.2.e Community Edition and higher.
List<Object> aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues();
if (!aspects.contains("P:cm:geographic")) {
aspects.add("P:cm:geographic");
HashMap<String, Object> props = new HashMap<String, Object>();
props.put("cmis:secondaryObjectTypeIds", aspects);
doc.updateProperties(props);
System.out.println("Added aspect");
} else {
System.out.println("Doc already had aspect");
}
@wk-j
wk-j / active.md
Created July 30, 2016 05:41 — forked from statguy/active.md

Most active GitHub users in Thailand

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 29 Jul 2015 01:52:41 GMT till Fri, 29 Jul 2016 01:52:41 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 6)
@wk-j
wk-j / CSharp6.md
Created August 1, 2016 06:04 — forked from ashmind/CSharp6.md

String interpolation

var x = 1;

// same as string.Format("A {0} B", x) 
var y1 = $"A {x} B"; // y == "A 1 B"

// $@ for multiline
var y2 = $@"A
@wk-j
wk-j / gist:e2d8e641b000b54bc2c23e67bc9fd4a8
Created September 12, 2016 07:29 — forked from tarnacious/gist:874052
Compiling SelectMany Linq without System.Linq. Also a List Monad.
using System;
using System.Collections.Generic;
public static class ExtensionMethods
{
public static IEnumerable<T> ToList<T>(this T value) {
yield return value;
}
public static IEnumerable<U> SelectMany<T, U>(this IEnumerable<T> m, Func<T, IEnumerable<U>> k)
@wk-j
wk-j / Tuple2.fs
Created September 14, 2016 04:36 — forked from ploeh/Tuple2.fs
Helpful functions for working with pairs in F#
module Tuple2
let replicate x = x, x
let curry f x y = f (x, y)
let uncurry f (x, y) = f x y
let swap (x, y) = (y, x)
@wk-j
wk-j / fp-lingo.md
Created March 16, 2017 13:00 — forked from ericelliott/fp-lingo.md
A Guide to Functional Programming Lingo for JavaScripters

A Guide to Functional Programming Lingo for JavaScripters

Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.

The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!

All examples using ES6 syntax. wrap (foo) => bar means:

function wrap (foo) {