Skip to content

Instantly share code, notes, and snippets.

<?php
function curl_setopt_custom_postfields($ch, $postfields, $headers = null) {
$algos = hash_algos();
$hashAlgo = null;
foreach ( array('sha1', 'md5') as $preferred ) {
if ( in_array($preferred, $algos) ) {
$hashAlgo = $preferred;
break;
}
}
@sepehr
sepehr / .htaccess
Created August 16, 2012 15:22
Apache: .htaccess Template
##
# Apache .htaccess template
##
## Protect files and directories from prying eyes.
<FilesMatch "\.(make|test|md|po|sh|.*sql|.*bson|tpl(\.php)?|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>
## Don't show directory listings for URLs which map to a directory.
@afair
afair / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@sepehr
sepehr / Default(OSX).txt
Last active January 19, 2016 03:18
Sublime Settings
[
{ "keys": ["ctrl+super+a"], "command": "alignment" },
{ "keys": ["ctrl+super+f"], "command": "reindent", "args": {"single_line": false}},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
@lwalen
lwalen / git-blame-colored
Created October 31, 2013 00:08
A fancy git blame. Presents code with initials of author to the left. Colors author's names and initials for easy blaming.
#!/usr/bin/env ruby
# Colorize string
class String
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
end
class Colors
@hyamamoto
hyamamoto / vimdiff.md
Created December 4, 2013 08:16
The vimdiff cheat sheet as a git mergetool.

vimdiff cheat sheet

This is a vimdiff cheat sheet as a git mergetool.

Commands

]c - go to next difference 
@dedy-purwanto
dedy-purwanto / gist:11312110
Created April 26, 2014 05:00
Bulk remove iTerm2 color schemes.
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all.
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one.
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist
@magnetikonline
magnetikonline / README.md
Last active November 27, 2023 21:12
Setting Nginx FastCGI response buffer sizes.
@jeffdgr8
jeffdgr8 / SumByColor.js
Last active December 15, 2018 22:25 — forked from clupasq/subByColor.js
function getBackgroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getBackground();
}
function getForegroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getFontColor();
}
@lenards
lenards / just_enough_scala.md
Last active October 1, 2022 23:32
A short introduction to Scala syntax and operations reworked and heavily borrowed from Holden Karau's "Scala Crash Course"

Just Enough Scala

(a moderately, well, shameless rework of Holden Karau's "Scala - Crash Course")

Scala is a multi-paradigm high-level language for the JVM.

It offers the ability to use both Object-oriented & Functional approaches.

Scala is statically typed. Type inference eliminates the need for more explicit type declarations.