Skip to content

Instantly share code, notes, and snippets.

View gregberge's full-sized avatar
😉
Building a better web

Greg Bergé gregberge

😉
Building a better web
View GitHub Profile
@tunguskha
tunguskha / CSS-color-var.md
Last active May 20, 2024 06:21
Darken & Lighten colors in pure CSS using variables.
:root {
  /* Base color using HSL */
  --hue: 207;
  --saturation: 64%;
  --light: 44%;
  
  /* Base color in variable */
  --primary-color: hsl(var(--hue), var(--saturation), var(--light));
 /* Base color lighten using calc */
@danieleggert
danieleggert / GPG and git on macOS.md
Last active October 27, 2024 11:07
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@Manouchehri
Manouchehri / cloudflare.sh
Last active October 22, 2024 19:05
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wearhere
wearhere / rewrite_CSP_header.js
Created December 17, 2014 04:36
How to rewrite the 'content-security-policy' HTTP header to work around bugs in the Chrome extension APIs: https://www.mixmax.com/blog/what-to-do-when-your-app-breaks
var hosts = 'https://d1j5o6e2vipffp.cloudfront.net';
var iframeHosts = 'https://app.mixmax.com';
chrome.webRequest.onHeadersReceived.addListener(function(details) {
for (var i = 0; i < details.responseHeaders.length; i++) {
var isCSPHeader = /content-security-policy/i.test(details.responseHeaders[i].name);
if (isCSPHeader) {
var csp = details.responseHeaders[i].value;
csp = csp.replace('script-src', 'script-src ' + hosts);
csp = csp.replace('style-src', 'style-src ' + hosts);
@davoclavo
davoclavo / ConfigurableFirmata.ino
Created September 15, 2014 19:46
adding DHT11Feature
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please click on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/
@vjo
vjo / meetup_waiting_pos.js
Last active August 1, 2016 17:38
Find your position in Meetup.com waiting list
$("#rsvp-list-waitlist h5")
.map(function(i, el) {return {"pos": i, "name": $(el).text()}})
.filter(function(i, el) {return el["name"].indexOf("Your name") >= 0;});
@mollerse
mollerse / gulpfile-express.js
Last active March 28, 2021 20:07
Gulpfile for livereload + static server
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@jamesvnz
jamesvnz / gcmcss.js
Created September 29, 2013 20:21
Sample node.js server code to implement an XMPP server that will integrate with Android's Google Cloud Messaging (GCM) "device to cloud" message functionality - CCS. This sample only receives upstream messages (i.e. from the device).
var xmpp = require('node-xmpp');
//Set node-xmpp options.
//Replace with your projectID in the jid and your API key in the password
//The key settings for CCS are the last two to force SSL and Plain SASL auth.
var options = {
type: 'client',
jid: '[email protected]',
password: 'XXXXXXXX',
port: 5235,
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.