Skip to content

Instantly share code, notes, and snippets.

View rondale-sc's full-sized avatar

Jonathan rondale-sc

  • Providence, Rhode Island
View GitHub Profile
@csfrancis
csfrancis / gdb_ruby_backtrace.py
Last active April 24, 2024 05:37
Dump an MRI call stack from gdb
# Updated for Ruby 2.3
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
@pixelhandler
pixelhandler / pre-push.sh
Last active April 8, 2024 01:04
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 7, 2024 01:38
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
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:

@shawndumas
shawndumas / findNodesBy.js
Created January 7, 2015 23:00
findNodesBy.js
/* globals module */
'using strict';
module.exports = function (options) {
if (arguments.length === 2) {
options = {
body: arguments[0],
match: arguments[1]
};
@alexlafroscia
alexlafroscia / jsconfig.json
Created August 20, 2018 19:55
Ember App jsconfig.json
{
"compilerOptions": {
"target": "es6",
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"origin-story-core-ui/*": ["./app/*"]
}
},
"exclude": [
@pguillory
pguillory / gist:729616
Created December 5, 2010 23:51
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}
@gmiroshnykov
gmiroshnykov / spawn_vim.js
Created March 24, 2012 09:54
Spawn a child process and bind it to parent's stdin, stdout and stderr in node.js
var tty = require('tty'),
spawn = require('child_process').spawn;
var child = spawn('vim');
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
process.stdin.pipe(child.stdin);
process.stdin.resume();
tty.setRawMode(true);
@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@ef4
ef4 / select.hbs
Last active October 7, 2021 09:41
Goodbye old Select View
<select onchange={{action (mut vehicle) value="target.value"}}>
{{#each vehicles key="@item" as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>{{vehicleChoice}}</option>
{{/each}}
</select>