Skip to content

Instantly share code, notes, and snippets.

Philipp Kyeck pkyeck

Block or report user

Report or block pkyeck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pkyeck
pkyeck / sha256.js
Created Feb 17, 2014
creating two different sha256 hashes
View sha256.js
var crypto = require("crypto");
var hash1 = crypto.createHash("sha256");
hash1.update("topsecret", "utf8");
console.log(hash1.digest("base64")); // UzNqZ2xkwTllU7K3yS84EmdognyTtk2RQgacEO2npyE=
var hash2 = crypto.createHash("sha256");
hash2.update("topSecret", "utf8");
console.log(hash2.digest("base64")); // mFuUzsUvYbRLt21+34+fwP6IpapAhqBLsbycLnGfQIc=
@pkyeck
pkyeck / retrieving.js
Last active Aug 29, 2015
Storing and retrieving secure passwords
View retrieving.js
var crypto = require("crypto");
// user submitted form with email + pwd
var pwd = req.params.pwd;
// fetch result from DB ...
// retrieve hash from DB and compare to pwd
var result = <RESULT>;
@pkyeck
pkyeck / gist:5757161
Created Jun 11, 2013
clickable "sass watch" command
View gist:5757161
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@pkyeck
pkyeck / gist:5318298
Last active Dec 15, 2015
GIT colors
View gist:5318298
[color]
ui = always
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
View codestyle.md

Code Style

  • Space indentation (2 spaces)
  • Double-quotes
  • Semicolon
  • Strict mode
  • No trailing whitespace
  • Variables at the top of the scope
  • Multiple variable statements
  • Space after keywords and between arguments and operators
@pkyeck
pkyeck / gist:2020764
Created Mar 12, 2012
ios background thread
View gist:2020764
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
/* do your copying here */
dispatch_async(dispatch_get_main_queue(), ^{
/* anything in here will happen on the main thread after the background thread has finished copying. For example, update your UI. */
});
});
You can’t perform that action at this time.