Skip to content

Instantly share code, notes, and snippets.

View andreasvirkus's full-sized avatar
🙊
made you look

andreas andreasvirkus

🙊
made you look
View GitHub Profile
@fideloper
fideloper / usevm.md
Created June 6, 2012 02:24
You should develop in a Virtual Machine

#You should do all your LAMP development in a Virtual Machine

##Here's Why:

Many of us develop on Macintoshes. There are many reasons for this, but one of them is that it's based on a Unix platform of some sort. This allows us to run common server software such as Apache, Ruby, Python and Nodejs on our Macs.

Our computers become powerful develoment machines similar to the servers our apps will eventually live on.

Sometime we start our computer only to find Apache won't start, or MySQL can't create a PID file, or we've updated to Mountain Lion and Apache needs to be reconfigured. Death!

@JaySunSyn
JaySunSyn / index.js
Created January 21, 2018 12:48
Firebase functions Dynamic OG-Tags
exports.host = functions.https.onRequest((req, res) => {
const userAgent = req.headers['user-agent'].toLowerCase();
let indexHTML = fs.readFileSync('./hosting/index.html').toString();
const path = req.path ? req.path.split('/') : req.path;
const ogPlaceholder = '<meta name="functions-insert-dynamic-og">';
const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">';
const isBot = userAgent.includes('googlebot') ||
userAgent.includes('yahoou') ||
userAgent.includes('bingbot') ||
@reggi
reggi / glob-up-and-running.md
Last active March 16, 2022 16:47
A tutorial on how to get started using glob patterns in your terminal. #writing

Glob Up and Running

To test a glob pattern go over to globtester and play around with creating your own file structure online, it's super easy to get started that way.

If you want to test out a glob pattern in the terminal use echo followed by the pattern, for instance.

echo **/*.js
@theodorosploumis
theodorosploumis / Install_Phpstorm.sh
Last active June 16, 2022 11:15
Update phpstorm on Ubuntu linux.
#!/bin/bash -e
# IMPORTANT. My phpstom installation exists on /opt/phpstorm.
# Early Access program: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program
# For stable releases try: https://data.services.jetbrains.com/products/download?code=PS&platform=linux
if [ "$(whoami)" != "root" ]
then
echo "Sorry, you are not root."
exit 1
fi
function addComments(arg, name) {
// 当参数前的注释不存在的情况, 加入 webpackChunkName 注释
if (!arg.leadingComments) {
arg.leadingComments = [
{
type: 'CommentBlock',
value: ` webpackChunkName: '${name}' `,
},
]
}
@usrme
usrme / ONELINERS.md
Last active April 19, 2023 06:37
Various oneliners from various languages/tools

Oneliners

Bash

  • Basic for loop to iterate over lines in a file:
for pkg in $(cat pkgs.txt); do sudo apt purge "$pkg" -y; done
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ericelliott
ericelliott / manifest.json
Created November 8, 2016 00:35
Sample manifest.json
{
"name": "My Progressive Web Application",
"short_name": "Progressive",
"start_url": "/?home=true",
"icons": [
{
"src": "/icons/icon36.png",
"sizes": "36x36",
"type": "image/png"
},
@jaredrummler
jaredrummler / youtube-to-bootanimation.sh
Last active November 12, 2023 19:58
Create an Android bootanimation from a YouTube video
#!/bin/bash
#
# youtube-to-bootanimation.sh - Download & create Android boot animations from YouTube videos
#
# author: Jared Rummler <jared@jrummyapps.com>
#
# Replace URL with any YouTube link
url="https://www.youtube.com/watch?v=Ynm6Vgyzah4"
# Set the frames per second for the boot animation