Skip to content

Instantly share code, notes, and snippets.

View moshfeu's full-sized avatar
🇮🇱
Standing for

Mosh Feu moshfeu

🇮🇱
Standing for
View GitHub Profile
@burt202
burt202 / test.js
Created July 10, 2014 09:53
Chai Custom Matcher
var chai = require('chai');
var expect = chai.expect;
var _ = require('underscore');
chai.use(function (chai, utils) {
var Assertion = chai.Assertion;
Assertion.addMethod('created', function (expected, idKey) {
var obj = this._obj;
@timgit
timgit / megaNumber.js
Last active January 15, 2020 08:35
Large number format filter for Angular written in ES6 that rounds to the specified decimal place (defaults to 1). 1 billion => 1B, 1,490,000 => 1.5M, 999,999 => 1M
angular.module('utilsModule').filter("megaNumber", () => {
return (number, fractionSize) => {
if(number === null) return null;
if(number === 0) return "0";
if(!fractionSize || fractionSize < 0)
fractionSize = 1;
var abs = Math.abs(number);
@iainjreid
iainjreid / package-json.d.ts
Last active February 13, 2020 20:28
A Typescript type definition for NPM package files
export interface IPackageJSON extends Object {
readonly name: string;
readonly version?: string;
readonly description?: string;
readonly keywords?: string[];
@Chocksy
Chocksy / nr_format.coffee
Created October 28, 2013 18:31
This is a simple angularjs filter that makes big numbers into short format. 1 milion becomes 1m and 1122 becomes 1.1k
@app = angular.module 'myApp', []
@app.filter "nrFormat", ->
(number) ->
if number!=undefined
console.log number
abs = Math.abs(number)
if abs >= Math.pow(10, 12)
# trillion
number = (number / Math.pow(10, 12)).toFixed(1)+"t"
else if abs < Math.pow(10, 12) and abs >= Math.pow(10, 9)
@jeffjohnson9046
jeffjohnson9046 / percent-filter.js
Last active September 4, 2020 23:25
Format percentages in AngularJS
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
return $filter('number')(input * 100, decimals) + '%';
};
}]);
@bastibense
bastibense / README.md
Last active September 28, 2020 03:53
Fix blurry fonts on some external monitors when using MacBook Pro Retina

How to fix blurry fonts on some external monitors when using MacBook Pro Retina

It seems that graphcis and fonts look rather blurry on some monitors when hooked up to a MacBook Pro (Retina). This might fix the issue for you:

  1. Download patch-edid.rb from http://embdev.net/attachment/168316/patch-edid.rb

  2. Execute in Terminal (without the $):

    $ ruby patch-edid.rb

  3. Copy produced folder (example: DisplayVendorID-22f0) to /System/Library/Displays/Overrides (authorize if needed, if the folder exists, backup it before)

@nimbupani
nimbupani / index.html
Created December 2, 2011 05:00
Showing latest post on home page with Jekyll
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>
@mariusschulz
mariusschulz / HtmlHelperExtensions.cs
Last active November 15, 2022 21:54
Two C# extension methods for inlining script and style bundles into the HTML response using ASP.NET MVC and the System.Web.Optimization framework.
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
public static class HtmlHelperExtensions
{
public static IHtmlString InlineScripts(this HtmlHelper htmlHelper, string bundleVirtualPath)
{
return htmlHelper.InlineBundle(bundleVirtualPath, htmlTagName: "script");
@johnschimmel
johnschimmel / server_simple.js
Created February 7, 2012 12:28
Simple NodeJS web server example
/************************************************
FILENAME
server_simple.js
DESCRIPTION
creates a simple web server that
display "Hello Dynamic World Wide Web"
HOW TO START SERVER:
1) from terminal run 'node simple_server.js'
@dtrce
dtrce / mp3.js
Created September 8, 2011 18:39
streaming mp3 using nodejs
var http = require('http'),
fileSystem = require('fs'),
path = require('path')
util = require('util');
http.createServer(function(request, response) {
var filePath = 'path_to_file.mp3';
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {