Skip to content

Instantly share code, notes, and snippets.

@parties
parties / renameReactJsToJsx.sh
Last active May 23, 2024 11:09
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active May 6, 2024 19:52
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@etoxin
etoxin / WebService.js
Last active August 19, 2022 13:30
Sample ES6 Service Class
import forEach from 'lodash/forEach';
/**
* Sample Web Service
* This is a sample service class that uses fetch and promises.
*
* I am using the http://httpbin.org endpoint to ensure this example is working properly.
*
* @class sampleWebService
*/
class sampleWebService {
@chsh
chsh / responsivle_mediaqueries.sass
Created February 24, 2017 01:16
Responsive Media Queries example from "bulma"
// Responsiveness
$tablet: 769px !default
// 960px container + 40px
$desktop: 1000px !default
// 1152px container + 40
$widescreen: 1192px !default
// 960 and 1152 have been chosen because
// they are divisible by both 12 and 16
@scottopell
scottopell / fix_exfat_drive.md
Last active May 17, 2024 16:32
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@Robertof
Robertof / agvtf-refresh-ip.sh
Created April 24, 2016 23:58
Hassle-free automatic IP renewer for what is known as "Technicolor AG plus VDNT-S Router VDSL2" or "Telecom Italia VDSL/Fibra modem".
#!/usr/bin/env bash
# Technicolor AG plus VDNT-S Router VDSL2 - (ba)sh IP renewer
# This script logs into the router and refreshes the IP address by toggling on
# and off the "automatic connection" parameter.
# It *NEEDS* to be configured. Please keep reading.
# Disable globbing, die on undefined variables and errors
set -efu
# Configuration
@xiian
xiian / gist:4998c569b5684af026d2
Created January 9, 2015 19:41
Set up all existing branches to rebase instead of merge
#!/bin/bash
git config branch.autosetuprebase always;
for BRANCH in `git for-each-ref --format='%(refname)' refs/heads/ | sed 's~refs/heads/~~g'`; do
git config branch.$BRANCH.rebase true;
echo "$BRANCH now set up for rebasing"
done
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@xem
xem / codegolf.md
Last active March 22, 2024 15:41
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 23, 2024 23:26
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)