Skip to content

Instantly share code, notes, and snippets.

View Lukas238's full-sized avatar
🏠
Working from home

Lucas Dasso Lukas238

🏠
Working from home
View GitHub Profile
@Sacristan
Sacristan / push_commits_by_chunks.sh
Last active July 18, 2024 15:03
Push commits by chunks
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=10
# check if the branch exists on the remote
# if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# # if so, only push the commits that are not on the remote already
# range=$REMOTE/$BRANCH..HEAD
# else
# # else push all the commits
@lmakarov
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@Axighi
Axighi / increase_replace.js
Created May 2, 2017 08:45
Using regex to replace match strings with auto increment number.
'An aplle is not a banana'.replace(/a/g, (() => {
var number = 0;
return () => {
return number++;
}
})())
@whophil
whophil / .gitignore
Created February 21, 2016 17:38 — forked from k0d3r/gist:3118874
.gitignore for OS (Windows/Mac) generated files
# Windows
Thumbs.db
desktop.ini
# OS X
.DS_Store
.Spotlight-V100
.Trashes
._*
@davidfergo
davidfergo / bulkRenGitTags.sh
Last active January 16, 2020 16:05
Bulk rename tags in git
# Rename tags named myapp-#.#.# to #.#.# and push the tag changes
git tag -l |grep ^myapp- | while read t; do n="${t##*-}"; git tag $n $t; git push --tags ; git tag -d $t; git push origin :refs/tags/$t ; done
@hissy
hissy / really-simple-csv-importer-addon.php
Created February 25, 2015 14:01
[Really Simple CSV Importer] Example: import image from url to custom field
<?php
/*
Plugin Name: Get Remote Image to Custom Field
*/
add_filter('really_simple_csv_importer_post_saved', function($post)
{
if (is_object($post)) {
// Get the meta data of which key is "image"
$image = $post->image;
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(js|css|png|jpe?g|gif|ico)) http://example.com/$1 [NC,P,L]
</IfModule>
@kiang
kiang / gist:9224e139320c230fedc5
Created December 24, 2014 01:41
batch push files into git repo with size limitation in each commit
<?php
$limit = 838860800;
exec('git status ' . __DIR__, $lines);
$lineCount = $currentFileSize = $pushCount = 0;
$sw = false;
foreach ($lines AS $line) {
if ($sw) {
++$lineCount;
if ($lineCount > 2) {
@anthonyholmes
anthonyholmes / bootstrap-sass-mixin-cheatsheet.scss
Created October 10, 2014 08:13
Bootstrap Sass Mixin Cheatsheet
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@addyosmani
addyosmani / README.md
Last active July 13, 2024 21:26 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version