Skip to content

Instantly share code, notes, and snippets.

using Microsoft.Phone.Controls;
using System;
using System.Windows.Controls.Primitives;
/// <summary>
/// This class detects the pull gesture on a LongListSelector. How does it work?
///
/// This class listens to the change of manipulation state of the LLS, to the MouseMove event
/// (in WP, this event is triggered when the user moves the finger through the screen)
/// and to the ItemRealized/Unrealized events.
@Miista
Miista / VisualStateHelper
Created February 20, 2014 08:03
VisualStateHelper for .NET
using System;
using System.Collections;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace NCore.Helpers {
public class VisualStateHelper {
public static void HookEvent<T>( DependencyObject onElement, string inVisualStateGroup, EventHandler<VisualStateChangedEventArgs> setHandler) where T : DependencyObject {
T button = VisualStateHelper.FindSimpleVisualChild<T>(onElement);
@Miista
Miista / Specific version of Homebrew package
Last active August 29, 2015 13:57 — forked from gcatlin/gist:1847248
Install a specific version of a Homebrew package
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
CREATE TABLE cast_info AS
SELECT DISTINCT ci.movie_id, ci.person_id, cn.name AS char_name, rt.role, ci.note, ci.nr_order
FROM imdb.ex x, imdb.cast_info ci, imdb.role_type rt, imdb.char_name cn
WHERE x.id = ci.movie_id
AND ci.role_id = rt.id
AND ci.person_role = cn.id;
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// Include latest version
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='http://code.jquery.com/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
// Include specific version
@Miista
Miista / Remove Homebrew package
Last active September 19, 2018 20:05
Remove a Homebrew package along with all of its dependencies
brew rm FORMULA
brew rm $(join <(brew leaves) <(brew deps FORMULA))
Run the last line a until `echo $(join <(brew leaves) <(brew deps FORMULA))` returns nothing OR until the last line informs you that `This command requires a keg argument`.
@Miista
Miista / Checkout PR
Created April 3, 2014 17:32
Checkout PR
git fetch origin pull/2/head
git checkout -b pullrequest FETCH_HEAD
OR
git fetch origin pull/<#>/head:<local_branch_name>
@Miista
Miista / Git Interactive Rebase Tips
Created May 9, 2014 18:59
Tips for using "git rebase --interactive"
If the commit you want to fix isn’t the most recent one:
git rebase --interactive $parent_of_flawed_commit
If you want to fix several flawed commits, pass the parent of the oldest one of them.
An editor will come up, with a list of all commits since the one you gave.
Change pick to reword (or on old versions of Git, to edit) in front of any commits you want to fix.
Once you save, Git will replay the listed commits.
ls *.<file-ext> | entr pandoc *.<file-ext> -o <output-name>