Skip to content

Instantly share code, notes, and snippets.

View idkjs's full-sized avatar

Alain Armand idkjs

View GitHub Profile
plutil -p xml1 Info.plist | grep "BundleName" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleShortVersionString" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleDisplayName" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleIdentifier" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
@chadedrupt
chadedrupt / AddressAutocomplete.js
Last active July 24, 2020 01:37
Knockout Binding for Google Places autocomplete input. Also populates sibling bindings that match address component types of the places api. That part depends on underscore.js.
ko.bindingHandlers.addressAutocomplete = {
init: function (element, valueAccessor, allBindingsAccessor) {
var value = valueAccessor(), allBindings = allBindingsAccessor();
var options = { types: ['geocode'] };
ko.utils.extend(options, allBindings.autocompleteOptions)
var autocomplete = new google.maps.places.Autocomplete(element, options);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
@azat-co
azat-co / express.js
Last active August 19, 2018 03:30
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
@katowulf
katowulf / jwtparser.js
Last active September 19, 2017 13:11
Deconstruct a JWT token for Firebase
// Helper function to extract claims from a JWT. Does *not* verify the
// validity of the token.
// credits: https://github.com/firebase/angularFire/blob/master/angularFire.js#L370
// polyfill window.atob() for IE8: https://github.com/davidchambers/Base64.js
// or really fast Base64 by Fred Palmer: https://code.google.com/p/javascriptbase64/
function deconstructJWT(token) {
var segments = token.split(".");
if (!segments instanceof Array || segments.length !== 3) {
throw new Error("Invalid JWT");
}
@kgriffs
kgriffs / vlc
Last active February 23, 2024 17:57
Run VLC from the command line on Mac OS X and stream internet radio (such as Radio Paradise).
#!/usr/bin/env bash
/Applications/VLC.app/Contents/MacOS/VLC -I rc "$@"
@atavener
atavener / database.ml
Created September 12, 2013 07:24
OCaml in-memory "database" -- I use this for component-based game-objects.
(* Database provides key-generation and table-instantiation,
* so that a key can be associated to various properties.
*)
(* This is for a fully-controlled specification...
*
* module Db = Database.Make (Database.IntKey)
* module Prop = Db.MultiInherit
* module PropHash = Prop.Table(Database.Hash)
* module Size = (val PropHash.create ~default:0 () : Db.Sig with type t = int)
@scy
scy / delete-from-repo.md
Created September 20, 2013 11:54
How to delete a file from a Git repository, but not other users' working copies

How to delete a file from a Git repository, but not other users' working copies

Suppose you have, by mistake, added your IDE's project folder (you know, these .idea folders with all kinds of local paths and configuration data and settings in it) to the Git repository of your project. (We're talking about a whole folder here, but the same rules apply to individual files as well.)

Of course, you only realize that two days after the fact and have already pushed it, and your colleagues have already pulled it. They use the same IDE as you do, so whenever they change a setting or fix paths, they can either

  • commit that, causing nasty merge conflicts for you and others or
  • ignore the changes and carry around a modified file until the end of time without ever committing it.

Why .gitignore won't help

@itsmattsoria
itsmattsoria / gistfil1.textile
Last active May 27, 2024 12:09
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@irazasyed
irazasyed / homebrew-permissions-issue.md
Last active June 14, 2024 17:01
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@mischah
mischah / z.md
Last active December 9, 2022 02:11
Installing und initializing z (https://github.com/rupa/z) with help of Homebrew.

#The power of z

Do you spend lots of time doing things like this?

cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwant

With z, you could just do this: