Skip to content

Instantly share code, notes, and snippets.

@cweekly
cweekly / foo.js
Created Apr 24, 2020 — forked from vvgomes/foo.js
Ramda vs Lodash
View foo.js
var _ = require("lodash");
var R = require("ramda");
var companies = [
{ name: "tw", since: 1993 },
{ name: "pucrs", since: 1930 },
{ name: "tw br", since: 2009 }
];
var r1 = _(companies).chain()
View keybase.md

Keybase proof

I hereby claim:

  • I am cweekly on github.
  • I am cweekly (https://keybase.io/cweekly) on keybase.
  • I have a public key ASC6Gqjhk4OfbXePcnexJyXe8iSMQADplLW8JsBzNrfykwo

To claim this, I am signing this object:

@cweekly
cweekly / how-to-image-magick-icons
Last active May 17, 2021
CLI ImageMagick (convert, mogrify, etc) create multi-layer favicon.ico from svg
View how-to-image-magick-icons
$ brew install imagemagick
# `convert` and `mogrify` provided by imagemagick
$ mogrify --version
Version: ImageMagick 7.0.7-3 Q16 x86_64 2017-09-18 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
# "mogrify quite useful in converting icons to multilayered ICO format from SVG images.
View proc_vs_lambda_test.rb
require 'minitest/autorun'
class ProcAndLambdaTest < Minitest::Test
def setup
@arr = [ 1, 2, 3 ]
end
def test_basic_return_behavior
# NOTE: Defining methods like this actually hoists them into the instance. I'm doing this purely
# for organization of the tests.
View learning-swift-link-list
@cweekly
cweekly / .gitconfig-partial-p4merge-cmds-2015-02-13
Last active Aug 29, 2015
.gitconfig for p4merge (dirs w spaces)
View .gitconfig-partial-p4merge-cmds-2015-02-13
[merge]
keepBackup = false
tool = p4merge
conflictstyle = diff3
[mergetool "p4merge"]
cmd = "'/Applications/p4merge.app/Contents/Resources/launchp4merge'" \
"\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
keepBackup = false
keepTemporaries = false
trustExitCode = false
View .zshrc-partial-git-aliases-2015-02-13
alias gba="git branch -avv"
alias gbl="git branch -lvv"
alias gd="git difftool"
alias gdh="git difftool HEAD"
alias gs="git status -s"
alias gst="gs | subl"
@cweekly
cweekly / apache-2.4-conf-rewrite-env-vars-example.conf
Last active Sep 17, 2020
Example of using mod_rewrite (and mod_setenvif) to manipulate query string parameters, via temp env vars
View apache-2.4-conf-rewrite-env-vars-example.conf
# Mod_rewrite is great at manipulating HTTP requests.
# Using it to set and read temp env vars is a helpful technique.
#
# This example walks through fixing a query string:
# Extract good query params, discard unwanted ones, reorder good ones, append one new one.
#
# Before: /before?badparam=here&baz=w00t&foo=1&bar=good&mood=bad
# After: /after?foo=1&bar=good&baz=w00t&mood=happy
#
# Storing parts of the request (or anything you want to insert into it) in ENV VARs is convenient.
View brew-formula-version-picker.gist
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Switch to git 1.9.0 in particular:
#
View p4merge4git.md