Skip to content

Instantly share code, notes, and snippets.

@morsdyce
morsdyce / byMultipleValues.js
Created May 29, 2013 14:45
Multiple value angular filter #angularjs #filter
'use strict';
var app = angular.module('vulcanApp');
app.filter('byMultipleValues', function() {
return function(data, params) {
if (params.length === 0) {
return data;
}
return data.filter(function(element, index) {
anonymous
anonymous / gist:5311068
Created April 4, 2013 14:54
public class FormHandler : DelegatingHandler
{
protected override System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
if (request.Content != null && request.Content.Headers.ContentType != null &&
request.Content.Headers.ContentType.MediaType == "application/x-www-form-urlencoded")
{
var routeData = request.Properties["MS_HttpRouteData"] as IHttpRouteData;
var form = request.Content.ReadAsFormDataAsync().Result;
@morsdyce
morsdyce / sortHtml.js
Created November 7, 2012 17:14
A function to sort a div element by its data attribute while moving html nodes without any performance hits of cloning or removing and reattaching a node.
function sortTableByColorSets() {
// store an empty object to contain all colors
var holdingCell = {};
// loop over the colors in the predfined colors array.
for (var color in colors) {
// get the color value and create a stub for it in the object. e.g object.colorname
colorValue = colors[color];
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active August 13, 2025 10:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@akost
akost / convert.sh
Created April 4, 2012 19:06
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do