Skip to content

Instantly share code, notes, and snippets.

Avatar
🐱
🙀

Maciej Woźniak iskeld

🐱
🙀
View GitHub Profile
@iskeld
iskeld / ProjectPropertyWriter.cs
Created Dec 1, 2013
A simple MSBuild Task to modify the project file properties.
View ProjectPropertyWriter.cs
using System.IO;
using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace EldSharp.Scripts.MsBuild
{
public sealed class ProjectPropertyWriterTask : Task
{
@iskeld
iskeld / ConEmu.CtrAltN.lua
Created Dec 4, 2013
FAR Manager macro which runs ConEmu tasks inside FAR current working directory.
View ConEmu.CtrAltN.lua
local ConEmu = "4b675d80-1d4a-4ea9-8436-fdc23f2fc14b"
local function RunTask(TaskName)
callString = string.gsub("Task(\"" .. TaskName .. "\",\"" .. APanel.Path .. "\")", "\\", "\\\\");
Plugin.Call(ConEmu, callString)
end
Macro { area="Shell"; key="CtrlAlt1"; action = function() RunTask("VSConsole") end; }
Macro { area="Shell"; key="CtrlAlt2"; action = function() RunTask("Powershell") end; }
@iskeld
iskeld / gist:10934747
Created Apr 16, 2014
trapped in the state monad
View gist:10934747
open System;
module StateMonad =
let (>>=) x f = (fun s0 ->
let a,s = x s0
f a s)
let kwik = (>>=)
let returnS a b = a, b
@iskeld
iskeld / NaryTreeStateMonad
Created May 29, 2014
F# State Monad implementation for n-ary tree (based on "The Zen of Stateless State" video by Brian Beckman)
View NaryTreeStateMonad
open System
type Tree<'a> =
| Leaf of 'a
| Branch of Tree<'a> list
type StateMonad<'state, 'content> = StateMonad of ('state -> ('state * 'content))
let testTree =
Branch [
View gist:ace7924025c3d5485090
function isCustomObject(obj) {
var result = obj && Object.prototype.toString.call(obj) == '[object Object]';
return result;
}
function deepOmit(obj) {
var newEntity = _.transform(obj, function(result, value, key) {
console.log(value.constructor.name);
var isParentProperty = String(key).toLowerCase().indexOf("parent") >= 0;
if (!isParentProperty) {
@iskeld
iskeld / combinations.fsx
Last active Aug 29, 2015
F# combinations generator. Based on the series "Producing combinations" by Eric Lippert
View combinations.fsx
(*
* F# Implementation of the combinations generator, based on the series "Producing combinations" by Eric Lippert
* - http://ericlippert.com/2014/10/13/producing-combinations-part-one/
* - ...
* - http://ericlippert.com/2014/10/27/producing-combinations-part-five/
*)
open System.Collections
open System.Collections.Generic
module List =
@iskeld
iskeld / Funktemplater.fs
Created Nov 16, 2014
Initial works on a simple Ms Word templating engine, using Office Open XML SDK
View Funktemplater.fs
open System;
open DocumentFormat.OpenXml;
open DocumentFormat.OpenXml.Packaging;
open DocumentFormat.OpenXml.Wordprocessing;
[<Literal>]
let openingBracket = "<#"
[<Literal>]
let closingBracket = "#>"
@iskeld
iskeld / OverridenFormatter.swift
Last active May 26, 2016
Swift base class exceptions
View OverridenFormatter.swift
/*
* Code to my question http://stackoverflow.com/questions/37448249/propagating-base-class-errors-in-swift
* I don't understand why there's such a difference in these two Formatters behavior
*/
import Cocoa
class OverridenFormatter: NSNumberFormatter {
override func getObjectValue(obj: AutoreleasingUnsafeMutablePointer<AnyObject?>, forString string: String, range rangep: UnsafeMutablePointer<NSRange>) throws {
// not doing anything, just delegating to the base class
try super.getObjectValue(obj, forString: string, range: rangep)
@iskeld
iskeld / shirt_fetcher.ex
Created Sep 24, 2017
Gildan Shirt imager fetcher in Elixir
View shirt_fetcher.ex
defmodule ShirtFetcher do
import Meeseeks.CSS
@output_dir "woman_shirts"
def fetch(url) do
root = URI.parse(url)
document = HTTPoison.get!(url)
links = Meeseeks.all(document.body, css("div.itemWrap > a"))
urls = for anchor <- links, href = Meeseeks.Result.attr(anchor, "href"), do: URI.merge(root, href) |> to_string()
You can’t perform that action at this time.