Skip to content

Instantly share code, notes, and snippets.

View akinsho's full-sized avatar

Akin akinsho

  • London
View GitHub Profile
@akinsho
akinsho / CMakeLists.txt
Created January 30, 2019 18:41 — forked from fracek/CMakeLists.txt
CMake and GTK+ 3
# Set the name and the supported language of the project
PROJECT(hello-world C)
# Set the minimum version of cmake required to build this project
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
# Setup CMake to use GTK+, tell the compiler where to look for headers
@akinsho
akinsho / pr.md
Created July 17, 2018 09:34 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@akinsho
akinsho / git-export
Created May 29, 2018 23:19 — forked from kristofferh/git-export
"Export" a git repository to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
@akinsho
akinsho / gist:808ada19f29a6dbc8f32fb15171131ea
Created May 8, 2018 21:41 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@akinsho
akinsho / merge-deep.js
Created March 27, 2018 18:02 — forked from kylealwyn/merge-deep.js
recursively merge two javascript objects
/**
* Simple is object check.
* @param item
* @returns {boolean}
*/
function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
@akinsho
akinsho / gist:8b74031d04baee7a6794f2668a48bd43
Created January 12, 2018 12:32 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@akinsho
akinsho / requestAnimationFrame.js
Created June 13, 2017 12:51 — forked from jacob-beltran/requestAnimationFrame.js
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
@akinsho
akinsho / client.js
Created April 21, 2017 23:11 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@akinsho
akinsho / gist:669d640d1de07839688a4b7b6a30da03
Created April 3, 2017 18:03 — forked from mikeal/gist:1840641
get a new/clean port with node.js
var portrange = 45032
function getPort (cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function (err) {
server.once('close', function () {
cb(port)
@akinsho
akinsho / b.rb
Created February 15, 2017 21:26 — forked from junegunn/b.rb
b - browse Chrome bookmarks with fzf
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |