Skip to content

Instantly share code, notes, and snippets.

View ezzabuzaid's full-sized avatar
🎯
Focusing

ezzabuzaid ezzabuzaid

🎯
Focusing
View GitHub Profile
@jareware
jareware / SCSS.md
Last active May 19, 2024 14:03
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@cmdoptesc
cmdoptesc / nodejs-express-cors.js
Created August 21, 2013 06:39
Node.js Express CORS settings / cross origin resource sharing / XMLHttpRequest Origin is not allowed by Access-Control-Allow-Origin
// Express CORS middleware.. so much easier than trying to get Restify to work
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'X-Requested-With, Accept, Origin, Referer, User-Agent, Content-Type, Authorization');
// intercept OPTIONS method
if (req.method === 'OPTIONS') {
res.send(200);

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
@sebble
sebble / stars.sh
Last active May 17, 2024 20:59
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 20, 2024 12:02
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@francoisromain
francoisromain / project-create.sh
Last active May 10, 2024 00:22
A bash script to create a Git post-receive hook to deploy after a Git push
#!/bin/bash
# source: https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3
# and another script to delete the directories created by this script
# project-delete.sh: https://gist.github.com/francoisromain/e28069c18ebe8f3244f8e4bf2af6b2cb
# Call this file with `bash ./project-create.sh project-name`
# - project-name is mandatory
# This will creates 4 directories and a git `post-receive` hook.
@othmanoss
othmanoss / nationalities.json
Created October 2, 2017 18:22
list of nationalities english arabic json
{
"Afghan": "أفغاني",
"Albanian": "ألباني",
"Algerian": "جزائري",
"American": "أمريكي",
"Andorran": "أندوري",
"Angolan": "أنغولي",
"Antiguans": "انتيغوا",
"Argentinean": "أرجنتيني",
"Armenian": "أرميني",
@LayZeeDK
LayZeeDK / web-application-horizontal-layers.csv
Last active January 19, 2023 11:57
Horizontal layers of a web application.
Horizontal layer Examples
Business logic Application-specific logic, domain logic, validation rules
Persistence WebStorage, IndexedDB, File System Access API, HTTP, WebSocket, GraphQL, Firebase, Meteor
Messaging WebRTC, WebSocket, Push API, Server-Sent Events
I/O Web Bluetooth, WebUSB, NFC, camera, microphone, proximity sensor, ambient light sensor
Presentation DOM manipulation, event listeners, formatting
User interaction UI behaviour, form validation
State management Application state management, application-specific events