Skip to content

Instantly share code, notes, and snippets.

View AlSquire's full-sized avatar

Arnaud Lécuyer AlSquire

View GitHub Profile
#!/usr/bin/env ruby
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
# https://dalibornasevic.com/posts/54-how-to-debug-stuck-ruby-processes
require 'tempfile'
require 'rbconfig'
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@ThomasSevestre
ThomasSevestre / partial_validation.rb
Last active January 9, 2019 14:32
ActiveRecord - Partial model validation
###
# DISCLAIMER - USE AT YOUR OWN RISK
# I'm using it with rails from version 4.2.4 to 4.2.6
#
# This file can be pasted in app/models/concerns
#
# This module needs to be included in the model to enable partial validation.
# It is designed to make partial validation transparent for the model.
# The controller is ... in control ;)
#
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@ttseng
ttseng / ffmpeg-ffmpegthumbnailer-heroku.md
Last active April 17, 2019 02:50 — forked from coopermaruyama/vendor-ffmpeg-heroku
install ffmpeg and ffmpegthumbnailer to your heroku app to use with carrierwave-video and carrierwave-video-thumbnailer

Preface

Below are the steps I took to install ffmpeg, ffmpegthumbnailer, and heroku to use with carrierwave-video and carrierwave-video-thumbnailer gems on my heroku app. I found there was no documentation to do exactly this, so I hope this is helpful for other people (and will save them the countless hours it took me to finally get it to work)

These are the libraries you will end up installing to get all of this to work.

  • x264
@AlSquire
AlSquire / index.html
Last active December 17, 2015 14:20
* Moved to https://github.com/AlSquire/GW2Dash * GW2 APIs + AngularJS example. Demo here: http://gw2api-angularjs.herokuapp.com/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>GW2API - AngularJS</title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular-resource.min.js"></script>
<script src="script.js"></script>
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@holin
holin / Omniauth Twitter Hash
Created March 27, 2012 08:19 — forked from charliemoseley/Omniauth Twitter Hash
Twitter Authentication hash
--
provider: twitter
uid: '15280529'
info:
  nickname: penguinbusiness
  name: Charlie Moseley
  location: Bellevue, WA
  image: http://a1.twimg.com/profile_images/281933747/kitamura_ava_normal.gif
  description: Developer, Otaku, Geek.
  urls:
#!/bin/sh
# 100Mo
SIZE=$((100 * 1048576 / 512))
BASEDIR="/usr/local/Cellar/mysql/5.5.15"
BIND_ARGS="--socket=/tmp/mysql_ram.sock"
# create ramdisk