Skip to content

Instantly share code, notes, and snippets.

View chrisvoo's full-sized avatar
🎸
hard as a rock

Christian Castelli chrisvoo

🎸
hard as a rock
View GitHub Profile
@metrofx
metrofx / glog
Created February 12, 2014 07:56
Pretty git log, displays 20 last commits.
#!/bin/sh
git --no-pager log -n 20 --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
@mindplay-dk
mindplay-dk / rm_r.php
Last active July 28, 2021 20:41
Recursively delete a directory and all of it's contents - USE AT YOUR OWN RISK!
<?php
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use SplFileInfo;
# http://stackoverflow.com/a/3352564/283851
/**
* Recursively delete a directory and all of it's contents - e.g.the equivalent of `rm -r` on the command-line.
// WARNING: There's much more to know/do around hooks, and
// this is just a simplification of how these work.
// shared references, updated
// per each hook invoke
let execution = null;
let current = null;
let context = null;
let args = null;
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
@bgrins
bgrins / Log-.md
Last active August 1, 2023 16:32
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@eridal
eridal / Compiler.java
Last active August 9, 2023 13:26
Java to PHP Compilation
package j2p;
import japa.parser.JavaParser;
import japa.parser.ParseException;
import japa.parser.ast.CompilationUnit;
import japa.parser.ast.ImportDeclaration;
import japa.parser.ast.PackageDeclaration;
import japa.parser.ast.body.BodyDeclaration;
import japa.parser.ast.body.ClassOrInterfaceDeclaration;
import japa.parser.ast.body.FieldDeclaration;
@gmccreight
gmccreight / master.vim
Last active September 23, 2023 08:41
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@mpj
mpj / example01.js
Created August 14, 2017 07:38
Code for the async/await episode of Fun Fun Function.
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`)
const data = await response.json()
return data.imageUrl
}
@sam-artuso
sam-artuso / setting-up-babel-nodemon.md
Last active November 3, 2023 08:52
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@fardjad
fardjad / how-to-start-colima-automatically-on-macos.md
Last active February 2, 2024 05:09
[How to start Colima automatically on macOS] Instructions for starting Colima automatically on macOS similar to Docker Desktop #macos #colima #docker

⚠️ Note: Since the merge of commit Homebrew/homebrew-core#149670, starting Colima is as easy as running brew services start colima. You can skip the following work-around.

Steps

  1. Create an executable script to run in foreground and manage colima:
cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg
#!/bin/bash