Skip to content

Instantly share code, notes, and snippets.

@ThomasArdal
ThomasArdal / Customer.cs
Created June 12, 2014 18:33
Elasticsearch migration c# example
namespace ConsoleApplication1
{
public class Customer
{
public int Zipcode { get; set; }
}
}
@rtrouton
rtrouton / gist:8016797
Last active September 28, 2023 12:54
createmyguest.sh script, original by nbalonso (https://gist.github.com/nbalonso/5696340)
#!/bin/bash
# Original script by Noel B. Alonso: https://gist.github.com/nbalonso/5696340
#variables
DSCL="/usr/bin/dscl"
SECURITY="/usr/bin/security"
LOGGER="/usr/bin/logger"
# Determine OS version
@paulirish
paulirish / performance.now()-polyfill.js
Last active December 11, 2024 09:06
performance.now() polyfill (aka perf.now())
// @license http://opensource.org/licenses/MIT
// copyright Paul Irish 2015
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
@maxkandler
maxkandler / gist:5233150
Created March 24, 2013 19:25
Hide the iTerm2 Dock icon.
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
@Ragnarokkr
Ragnarokkr / isSafePath.js
Last active December 15, 2015 03:09
Verifying a valid object property could be overly painful when we have to do with 'object.foo.bar.baz.one.two.three'. The goal of these solutions is to give a powerful hand in checking those kind of very-depth-objects. They allow to check for a valid "object path" of any depth. Short-circuiting and caching are provided to speed the check up. Fur…
/*
* Checks object paths of any depth, with short-circuiting and caching.
* Prototype version.
*
* @author Marco Trulla <marco@marcotrulla.it> http://marcotrulla.it
* @version 0.1
* @license MIT http://opensource.org/licenses/MIT
* @return boolean
* @example
*
@HansCz
HansCz / remove_and_re-add_iterm_dock_icon.bash
Last active December 12, 2015 02:08
ITerm (Bash) - Removing and re-adding the dock icon for ITerm
# ref: http://code.google.com/p/iterm2/issues/detail?id=1271#c7
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# And this to undo:
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist
@nazoking
nazoking / gist:2822127
Created May 29, 2012 02:00
get image mime type from base64
function guessImageMime(data){
if(data.charAt(0)=='/'){
return "image/jpeg";
}else if(data.charAt(0)=='R'){
return "image/gif";
}else if(data.charAt(0)=='i'){
return "image/png";
}
}
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;