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
@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, {
@geuis
geuis / json.js
Created November 15, 2011 16:01
Better error handling for JSON.parse (javascript)
(function(){
var parse = JSON.parse;
JSON = {
stringify: JSON.stringify,
validate: function(str){
@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>
@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'
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@AndreasMadsen
AndreasMadsen / gist:2693051
Created May 14, 2012 10:04
base64 shim [atob, btoa]
// Source: http://code.google.com/p/gflot/source/browse/trunk/flot/base64.js?r=153
/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
@trongthanh
trongthanh / gist:2779392
Last active April 24, 2024 23:46
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@mrchief
mrchief / LICENSE.md
Last active March 23, 2024 12:28
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@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)

@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)