Skip to content

Instantly share code, notes, and snippets.

View jdeebee's full-sized avatar

Javad Boroujeni jdeebee

View GitHub Profile
@uarun
uarun / filetype.vim
Created August 3, 2011 19:32
Gradle syntax highlighting in vim
# ~/.vim/filetype.vim
au BufNewFile,BufRead *.gradle setf groovy
@nhoffman
nhoffman / pyscript.py
Last active May 8, 2024 14:26
Python script template
#!/usr/bin/env python3
"""A simple python script template.
"""
import os
import sys
import argparse
@kdabir
kdabir / replace_quotes.groovy
Created September 22, 2012 14:35
Replace quotes from string in groovy
println """
some "text" with quotes
""".replaceAll (/\"/,/\\\"/)
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@textarcana
textarcana / centos-install-syntax-highlighting-in-less.sh
Last active May 1, 2023 01:01
2020 update: just use bat(1) instead!!!! bat has git integration and also can show invisible characters! OLD STUFF: How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm
@patrickhammond
patrickhammond / gist:7598623
Last active August 13, 2021 03:03
Adds list dividers between children in a linear layout. showDividers takes a set of flags (ex: you can specify beginning|middle|end to get dividers at the start of the layout, through the layout, and at the end of the layout. API 11+ http://developer.android.com/reference/android/widget/LinearLayout.html#setShowDividers(int)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle"
android:divider="?android:listDivider"
android:dividerPadding="16dp">
</LinearLayout>
@programatt
programatt / function_composition.hs
Created January 22, 2014 02:49
Haskell Function Composition with multiple arguments example
f :: [Bool] -> Bool
f = and
g :: (Eq a) => ([a],[a]) -> [Bool]
g = uncurry $ zipWith (==)
h :: (Eq a) => ([a],[a]) -> Bool
h = f . g
f' :: [Bool] -> Bool
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@othiym23
othiym23 / npm-upgrade-bleeding.sh
Created September 20, 2014 19:36
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@mrleolink
mrleolink / CustomEllipsizeTextView.java
Created November 20, 2014 08:56
A hack to set custom ellipsize and postfix string for Android's TextView
public class CustomEllipsizeTextView extends TextView {
private static final int MAX_LINE = 2;
private static final String ELLIPSIZE_STRING = "...";
private String originalText;
private int maxLines = MAX_LINE;
private String postfix;
private boolean postfixAdded;