Skip to content

Instantly share code, notes, and snippets.

View weiland's full-sized avatar
🍫
🎓 && 💻 #GitHubDropICE

Pascal Weiland weiland

🍫
🎓 && 💻 #GitHubDropICE
View GitHub Profile
@weiland
weiland / clone-array.js
Created April 7, 2015 10:31
Clone an Array in JavaScript
// extending the Array prototype
Array.prototype.clone = function clone() {
return this.slice(0);
};
// example
var arr = [4,5];
var copy = arr.slice(0);
// better (since we do not extend the prototype):
@weiland
weiland / browser_metrics.md
Created March 30, 2015 13:36
Browser window metrics

Browser window metrics

Global properties

window.innerWidth
window.innerHeight
window.pageXOffset
window.pageYOffset
document.documentElement.clientWidth
document.documentElement.clientHeight
@weiland
weiland / speech.js
Created March 22, 2015 22:15
Web Speech API - Speech Synthesis Example
speechSynthesis.getVoices().forEach(function(voice) {
utterance = new SpeechSynthesisUtterance('PENIS');
utterance.voice = voice;
speechSynthesis.speak(utterance);
});
@weiland
weiland / .zshrc
Last active August 29, 2015 14:17
windows configuration and installtion
alias p="cd /cygdrive/d/dev/projects/git/"
alias c="cd //chayns1/SlitteRessource"
alias api="cd //chayns1/SlitteRessource/API/"
alias winx='/cygdrive/c/Windows/explorer.exe /e,`cygpath -w $PWD`'
alias nw="mintty.exe -i /Cygwin-Terminal.ico - &"
alias s="/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"
alias hi="hicat"
@weiland
weiland / README.md
Created March 13, 2015 22:04
Mac OS X - RubyMine, WebStorm, IntelliJ Java Version Error

Fixing Webstorm / RubyMine etc

At first, check your java version: java -version.

Open /Applications/{RubyMine,WebStorm}.app/Contents/Info.plist

Look for <key>JVMVersion</key> and change the version to:

<string>1.*</string>
@weiland
weiland / FacebookCTRL.cs
Created March 10, 2015 09:10
fb controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
namespace dlitfass.Data
{
public class FacebookController
{
@weiland
weiland / remove-vendor-shadow.css
Created February 20, 2015 10:13
TIL: remove safari mobile (webkit) shadow from input fields
-webkit-appearance: none;
@weiland
weiland / convert-date.js
Created February 19, 2015 10:21
Converting a c# Date with Javascript into a Javascript Date Object
var cSharpDate = '/Date(1424259189000)/'; // if one has to handle with a C# Date String
var jsDate = new Date(parseInt(cSharpDate.substr(6)));
// will output: Wed Feb 18 2015 12:33:09 GMT+0100 (Mitteleuropäische Zeit)
@weiland
weiland / ArticleModel.cs
Last active August 29, 2015 14:15
C# Model: Dealing with Currency
private string _articlePrice;
public string ArticlePrice {
get
{
return _articlePrice;
}
set
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("de");
_articlePrice = String.Format("{0:C}", decimal.Parse(value));
@weiland
weiland / .gitignore
Last active August 29, 2015 14:15
MS VisualStudio .NET MVC gitignore file (hopefully i never ever have to use it again)
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results