Skip to content

Instantly share code, notes, and snippets.

@darrennolan
darrennolan / .bash_profile
Created April 11, 2019 02:01
All the files and shit I have for my terminal stuffz.
if hash uname 2>&-; then
os_type=`uname -s`
else
os_type="unknown"
fi
if [[ $os_type == "Darwin" ]]; then
export CLICOLOR=1
@darrennolan
darrennolan / update-mac.sh
Created July 27, 2017 01:47 — forked from anonymous/update-mac.sh
Update Mac Software script (super quicker than app store)
#!/usr/bin/env bash
softwareupdate -l
while true; do
echo "Do you wish to update all the above things?"
read -p "[y/n]? " yn
case $yn in
[Yy]* ) softwareupdate -i -a; break;;
[Nn]* ) exit;;
let myArray = ['Pizza', 'Apple', 'Banana'];
let combinedString = myArray.reduce((combinedString, item, index) => {
if (index != 0) {
return `${combinedString} and ${item}`;
} else {
return item;
}
}, '');
console.log(combinedString); // Pizza and Apple and Banana
@darrennolan
darrennolan / nodejs.log
Created June 15, 2016 10:17
Node Output from spawned process output (before crashing).
[2016-06-15 20:14:58.477] [DEBUG] [event:process_stdout] - [id:cipgph08809873pp79ucannl7] [project:video-4.0.0] [msg:
<--- Last few GCs --->
939981 ms: Scavenge 1396.3 (1457.6) -> 1396.3 (1457.6) MB, 45.7 / 0 ms (+ 0.8 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
941852 ms: Mark-sweep 1396.3 (1457.6) -> 1395.7 (1456.6) MB, 1871.6 / 0 ms (+ 1.9 ms in 2 steps since start of marking, biggest step 1.1 ms) [last resort gc].
943677 ms: Mark-sweep 1395.7 (1456.6) -> 1393.9 (1457.6) MB, 1824.6 / 0 ms [last resort gc].
<--- JS stacktrace --->
[alias]
delete-merged-branches = "!f() { git checkout --quiet develop && git branch --merged | grep --invert-match '\\*' | xargs -n 1 git branch --delete; git checkout --quiet @{-1}; }; f"
owc = !vim -O `git whatchanged -n1 | grep ^: | awk '{print $NF}'`
om = !vim -O `git st | grep 'modified:' | awk '{print $NF}'`
omn = !vim -O `git st | egrep -w 'modified:|new file:' | awk '{print $NF}'`
com = !git checkout `git st | grep modified | awk '{print $3}'`
ai = add -i
ap = add -p
rb = rebase -i
co = checkout
<?php
class A
{
public static $name = 'a';
public static function getSelfName()
{
return self::$name;
}

Keybase proof

I hereby claim:

  • I am darrennolan on github.
  • I am darrennolan (https://keybase.io/darrennolan) on keybase.
  • I have a public key whose fingerprint is 4EFD AC79 E904 EBFB 5BCB 0999 DB69 1F7D AAE7 9E23

To claim this, I am signing this object:

{
"auto_find_in_selection": true,
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/User/predawn (SL).tmTheme",
"copy_with_empty_selection": false,
"default_line_ending": "unix",
"detect_indentation": false,
@darrennolan
darrennolan / Mac Network Throttle
Created March 27, 2014 19:28
Basic ipfw usage to throttle your network connection on a Mac (Mountain Lion)
# Step 1: Creates a pipe that only allows up to 15KB/s to go through.
sudo ipfw pipe 1 config bw 15KByte/s
# Step 2: Add the pipe to downloads on port 80
sudo ipfw add 1 pipe 1 src-port 80
## OR ##
# Step 2: Add the pipe to uploads and downloads on all ports
@darrennolan
darrennolan / trimSerialize.jquery.js
Created February 7, 2014 05:26
jQuery Trim Serialize form function. Leaves previous form intact, allows for giving selector for trim to run on. Defaults to only input[type=text] inputs.
(function($) {
/**
* Trim Form Elements before returning Serialize()
* @param {string} selector Defaults to 'input[type=text]'
* @return {serialized()} Returned jQuery serialize() string
*/
$.fn.trimSerialize = function(selector) {
// Deep clone form (to get all nested elements), then unbind everything off the clone
var clonedObject = $(this).clone(true).off();