Skip to content

Instantly share code, notes, and snippets.

View bratsche's full-sized avatar

Cody Russell bratsche

View GitHub Profile
void HandleSearchEntryActivated (object sender, EventArgs e)
{
var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
if (pattern.Pattern == null && pattern.LineNumber > 0) {
DestroyPopup ();
var doc = IdeApp.Workbench.ActiveDocument;
if (doc != null && doc.Editor != null) {
doc.Select ();
doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1);
doc.Editor.CenterToCaret ();
@bratsche
bratsche / gist:ee81699a6960fb3b1233
Last active August 29, 2015 14:23
Seq.findIndex
F# Interactive for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
> let scale1 = seq { -0.5 .. 0.1 .. 0.5 } ;;
val scale1 : seq<float>
> scale1 |> Seq.toArray ;;
@bratsche
bratsche / fix-postgres-seqs.rb
Last active September 30, 2015 11:37
Fix up broken id seqs on Postgres after migrating from MySQL using ar_dbcopy gem
require 'pg'
unless ARGV[0]
puts "Pass the name of the database"
exit 1
end
# Get our Postgres connection
conn = PGconn.open(:dbname => ARGV[0], :host => 'localhost')
@bratsche
bratsche / gist:2323633
Created April 6, 2012 22:40
Get implementations
List<T> GetInstances<T>()
{
return (from t in Assembly.GetExecutingAssembly().GetTypes()
where t.GetInterfaces().Contains(typeof (T)) && t.GetConstructor(Type.EmptyTypes) != null
select (T) Activator.CreateInstance(t)).ToList();
}
@bratsche
bratsche / gist:2645575
Created May 9, 2012 15:32
sass mixin for adding arrows to a div
$defaultBorder: none
=arrow($direction, $size, $color, $border: $defaultBorder)
position: relative
border: $border
&:after, &:before
@if $direction == top
bottom: 100%
@else if $direction == right
@bratsche
bratsche / unmuck.sh
Created October 12, 2015 19:14
Autoconf cleanup for El Capitan
#!/bin/sh
while true
do
if [ -d confdir-14B---/confdir-14B--- ]
then
mv confdir-14B---/confdir-14B--- a
fi
if [[ $? -ne 0 ]]
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <stdio.h>
/* Don't get link errors because mkdir is redefined to rpl_mkdir. */
#undef mkdir
@bratsche
bratsche / cairo-win32-font-device-scale.diff
Created December 4, 2015 20:16
Cairo Win32 font changes for device scale
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -379,6 +379,8 @@ _win32_scaled_font_create (LOGFONTW *logfont,
/* don't delete the hfont if we're using the one passed in to us */
f->delete_scaled_hfont = !f->scaled_hfont;
+ cairo_matrix_scale (font_matrix, 1.0 / device_scale, 1.0 / device_scale);
+ cairo_matrix_scale (ctm, device_scale, device_scale);
cairo_matrix_multiply (&scale, font_matrix, ctm);
status = _compute_transform (f, &scale);
diff --git main/src/addins/MacPlatform/MacPlatform.cs main/src/addins/MacPlatform/MacPlatform.cs
index a55635f..b3f3b79 100644
--- main/src/addins/MacPlatform/MacPlatform.cs
+++ main/src/addins/MacPlatform/MacPlatform.cs
@@ -285,14 +285,22 @@ namespace MonoDevelop.MacIntegration
ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null) {
IdeApp.Workbench.RootWindow.Deiconify ();
+ IdeApp.Workbench.RootWindow.Visible = true;
@bratsche
bratsche / gist:6186287
Created August 8, 2013 16:37
gtk.immodules
"/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/lib/gtk-2.0/2.10.0/immodules/im-am-et.so"
"am_et" "Amharic (EZ+)" "gtk20" "/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/share/locale" "am"
"/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk20" "/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"
"/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/lib/gtk-2.0/2.10.0/immodules/im-cocoa.so"
"cocoa" "Mac OS X Cocoa" "gtk+" "" "ja:ko:zh"
"/Users/cody/xamarin/bockbuild/profiles/monodevelop-mac-dev/build-root/_install/lib/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.so"