This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app') | |
.service('myService', function($rootScope) { | |
// Inject an isolate scope into the rootscope to | |
// enable us to use $watch to from a service | |
this.scope = $rootScope.$new(true); | |
this.scope.myService = this; | |
this.scope.$watch('something', function() {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
proxy_pass http://localhost:3000; | |
auth_request /api-qa/user; | |
} | |
error_page 401 /auth.html; | |
error_page 403 /auth.html; | |
location ~ /api|api|auth|css|fonts|favicon|images/ { | |
auth_request off; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert -gravity center -distort SRT 45 loading-1.png loading-2.png | |
convert -gravity center -distort SRT 90 loading-1.png loading-3.png | |
convert -gravity center -distort SRT 135 loading-1.png loading-4.png | |
convert -gravity center -distort SRT 180 loading-1.png loading-5.png | |
convert -gravity center -distort SRT 225 loading-1.png loading-6.png | |
convert -gravity center -distort SRT 270 loading-1.png loading-7.png | |
convert -gravity center -distort SRT 315 loading-1.png loading-8.png | |
convert -channel A -dither Riemersma -delay 10 loading-*.png loading.gif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
document.write("<base href='" + document.location.href.replace("index.html", "").split("#")[0] + "' />"); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getFoo = function(){ | |
var val = ""; | |
$.get(".", function(){ | |
val = {foo: "bar"}; | |
}); | |
return val; | |
} | |
var foo = getFoo(); | |
// foo = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
NUM_ERRORS=`npm test | grep -c ERR` | |
if [ $NUM_ERRORS -ne 0 ] | |
then | |
echo -e "One or more tests failed, commit aborted" | |
exit 1 | |
else | |
echo -e "All tests passed, proceeding with commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nodemailer = require("nodemailer"); | |
var transport = nodemailer.createTransport("SMTP", { | |
service: "Gmail", | |
auth: { | |
user: "[email protected]", | |
pass: "******" | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = "{ a: 0, b: [ 1, 2, 3, ], }"; | |
s = s.replace(/\,(\s+)(\]|\})/g, "$1$2"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git shortlog -s -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private float seed = 1.0f; | |
float PseudoRandom(){ | |
seed = (seed * 9301 + 49297) % 233280; | |
return seed / 233280; | |
} |