Skip to content

Instantly share code, notes, and snippets.

View Maxwell2022's full-sized avatar
🤖
Making your life easier

Maxime Maxwell2022

🤖
Making your life easier
View GitHub Profile
@Maxwell2022
Maxwell2022 / .gitconfig
Last active September 27, 2018 08:47
.gitconfig file sitting in the user home directory to apply global rules for all repos
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = false
precomposeunicode = false
excludesfile = ~/.gitignore_global
[alias]
st = status
<?php
function getS3Settings($filename)
{
$AWSbucket = 'YOUR_BUCKET_NAME';
$AWSkey = 'YOUR_ACCESS_KEY';
$AWSsecret = 'YOUR_SECRET_KEY';
$acl = 'public-read'; // private
// Get the file extension
# Set some aliases
alias tmux="TERM=screen-256color-bce tmux"
alias ll='ls -Gal'
alias ..="cd .."
alias ...="cd ../.."
alias gti="git"
alias flushdns="dscacheutil -flushcache" # Flush DNS cache
# Load ~/.profile
source ~/.profile
@Maxwell2022
Maxwell2022 / category_tree.php
Last active December 27, 2015 13:19
Create a tree structure from a flat structure efficiently using variable addresses
protected function getCategoryTree()
{
// IMPORTANT: Return categories sorted by parent_id ASC
$categories = $this->em->getRepository('ZumnyCoreBundle:Category')->findAll();
$flat = array();
$tree = array();
/** @var EntityCategory $category */
foreach ($categories as $category) {
@Maxwell2022
Maxwell2022 / Geo.php
Last active August 29, 2015 14:00
Geo Location functions
<?php
namespace Acme\Component\Utils;
class Geo
{
const EARTH_RADIUS = 3959; // in miles
/**
* Given a $centre (latitude, longitude) co-ordinates and a
@Maxwell2022
Maxwell2022 / javascript_resources.md
Last active August 29, 2015 14:09 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@Maxwell2022
Maxwell2022 / new_gist_file_0
Created November 25, 2014 05:30
Bookmark to use chrome as Text editor
data:text/html,<title>DoJS</title><style type="text/css">#e{font-size: 16px; position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");</script>
@Maxwell2022
Maxwell2022 / parse_log.sh
Last active August 29, 2015 14:17
Script to concatenate rotating logs for nginx and nodejs
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please specify the path of the logs in the first argument"
exit 0;
fi
ROOT=$1
{
"notifications": {
"timeIntervalMax": 300,
"title": "On the move?",
"message": "Looks like you are travelling, check out the games in [CITY]!"
},
"cities": [
{
"id": 56,
"name": "Sydney, NSW",
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdjustWindowForFontSizeChange</key>
<true/>
<key>AllowClipboardAccess</key>
<false/>
<key>AnimateDimming</key>
<false/>