This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtCore/QFile> | |
#include <QtCore/QDir> | |
/// Store pixmap in home directory as .png file | |
static void | |
DumpPixmapToFile(const QPixmap &pixmap) { | |
QString filepath = QDir::home().filePath("debug-pattern.png"); | |
pixmap.save(filepath, "PNG"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f | xargs sed -i 's/[ \t]*$//' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in 1:length(M) | |
println(i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Settings : UITableViewController { | |
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | |
let cell = tableView.cellForRowAtIndexPath(indexPath) | |
// The cells contentview is the one containing custom added components. | |
if let subviews = cell?.contentView.subviews { | |
// Find a subview which is a UITextField. Place cursor in this textfield. | |
for view in subviews { | |
if let textfield = view as? UITextField { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Celsius float64 | |
// Implement Stringer interface, used by %s in Printf | |
func (deg Celsius) String() string { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
using PList | |
import GoTMSupport | |
bundle_support = ENV["TM_BUNDLE_SUPPORT"] | |
dialog = ENV["DIALOG"] | |
gocode = ENV["TM_GOCODE"] | |
filepath = ENV["TM_FILEPATH"] | |
row = int(ENV["TM_LINE_NUMBER"]) | |
col = int(ENV["TM_LINE_INDEX"]) + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod(A, C) == r | |
# then | |
mod(A + k*C, C) == r | |
# so if | |
mod(A, C) == mod(B, C) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check if A is congruent to B modulo C. | |
in_same_equivalence_class(A, B, C) = mod(A, C) == mod(B, C) | |
# find all X in Xs where X is congruent to B modulo C | |
function find_numbers_in_same_equivalence_class(A, C, Xs) | |
r = mod(A, C) | |
filter(X->mod(X,C) == r, Xs) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
[mergetool "sourcetree"] | |
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" | |
trustExitCode = true | |
[alias] | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make the blue color for directories more readable | |
set -x LSCOLORS Exfxcxdxbxegedabagacad | |
# this is needed to avoid strange python stack backtrace complaining about UTF-8 when | |
# running sphinx. Found it by googling | |
set -x LC_ALL en_US.UTF-8 | |
set -x LANG en_US.UTF-8 | |
set -x JULIA_EDITOR textmate | |
# so our brew install override the commands from the system |
NewerOlder