Skip to content

Instantly share code, notes, and snippets.

View yahyaKacem's full-sized avatar

Yahya Kacem yahyaKacem

View GitHub Profile
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@0x-r4bbit
0x-r4bbit / proposal.md
Last active May 2, 2022 03:50
Proposals on how to structure 'standalone' modules in angular. Please read it and leave your opinions for a better angularjs world!

Angular module structure (proposal)

Everyone who's reading this, please leave your opinion/ideas/proposals as a comment for a better world!

Background

Most of you guys read Josh' proposals to make components more reusable, I think. Now, reading through this proposals definitely gives a feeling that this is the right way. Anyways, If you haven't read it yet, you should.

So Josh shows us, how angular apps can be structured in a better and more reusable way. Reusability is a very important thing when it comes to software development. Actually the whole angularjs library follows a philosophy of reusability. Which is why you able to make things like:

@pavelbinar
pavelbinar / creare-gradient.sh
Created February 20, 2014 15:34
Generate gradient via ImageMagick at Mac os X command line
# Color to color
convert -size 2000x100 gradient:#4b4-#bfb ./gradient.gif
# Color to transparent
convert -size 500x500 gradient:none-firebrick gradient_transparent.png
@maggiben
maggiben / humanize.js
Last active October 21, 2018 11:35
Human Readable Numbers (AngularJS filter)
angular.module('humanize', [])
.filter('humanize', function(){
return function humanize(number) {
if(number < 1000) {
return number;
}
var si = ['K', 'M', 'G', 'T', 'P', 'H'];
var exp = Math.floor(Math.log(number) / Math.log(1000));
var result = number / Math.pow(1000, exp);
result = (result % 1 > (1 / Math.pow(1000, exp - 1))) ? result.toFixed(2) : result.toFixed(0);
@maximilian-lindsey
maximilian-lindsey / express_in_electron.md
Last active March 29, 2024 22:46
How to run Express inside an Electron app

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app