Skip to content

Instantly share code, notes, and snippets.

Axel axelerator

  • Shopify
  • Montreal, Canada
View GitHub Profile
View Find unused variables in sass files
or i in `grep -h '^$[a-z_][^:]*' *.sass | sed 's|$\([a-z_][^:]*\).*|\1|'` ; do echo -n $i; grep $i *.sass | wc -l ; done | grep ' 1$'
View find images with low resolution
find . | grep 'original/' | xargs identify | cut -d ' ' -f 3,1 | grep '[^0-9][0-9][0-9]x\|x[0-9][0-9]$'
View anonymize email adresses in postgresql
update person set email = regexp_replace(email, E'@(.*)', '\\1@example.com');
View gist:674032
public interface KeyValueFunction<KI, VI, KO, VO> {
Map.Entry<KO, VO> f(KI k, VI v);
}
/**
* Creates a new map by applying each element to the converter.
*
* @param <KI> key type of input map
* @param <VI> value type of input map
View Pickle.hs
{-# LANGUAGE Arrows #-}
module Pickle where
import Control.Arrow
import Control.Arrow.ListArrow
import Text.XML.HXT.Arrow.Pickle
import Text.XML.HXT.Arrow.ReadDocument
data Strukt = Strukt {
text :: String
@axelerator
axelerator / namevoting
Created Jun 19, 2011
Small programm to combine syllables, where some syllables are used only as suffix/prefix
View namevoting
{-
- Small programm to combine syllables, where some syllables
- are used only as suffix/prefix
- 1. Install: GHC
- 2. Compile: ghc -o namevote namevoting.hs
- 3. Run: namevote '[Pre "neo", Suf "master", Pre "turbo", Uni "leo", Suf "3000"]'
-}
module Main where
import System.Environment
@axelerator
axelerator / sumgitachievements.sh
Created Sep 27, 2011
sum of all git achievement levels
View sumgitachievements.sh
git achievements -l | grep '(Level' | sed 's/\(\s*.*(Level\)//g' | tr -d ')' | tr -s ' ' |tr "\n" '+' | sed 's/$/ 0/' | xargs expr
@axelerator
axelerator / onliners
Last active Apr 22, 2016
oneliners.md
View onliners
# Ruby
Hash[*((0..4).flat_map{|i| ['column_' + i.to_s, nil]})]
# => {"column_0"=>nil, "column_1"=>nil, "column_2"=>nil, "column_3"=>nil, "column_4"=>nil}
# Shell
### Bildersequenzen in Video für Web konvertieren mit:
View custom_search.rb
class HomeController < ApplicationController
class MovieSearch < FortyFacets::FacetSearch
model 'Movie' # which model to search for
custom :for_manual_handling
end
def index
View gist:01ab50c21a25a1b93164f86a087dfda0
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/var/www/APP_NAME/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name APP_NAME.42ls.de APP_NAME.42ls.de;
You can’t perform that action at this time.