Skip to content

Instantly share code, notes, and snippets.

@bnchdrff
bnchdrff / ec2-fix-grub-squeeze
Created May 11, 2011 15:16
debian squeeze on ec2 grub fix
# per http://groups.google.com/group/ec2debian/browse_thread/thread/cf14dbd5e04fab41/40097775d0c6c04d
apt-get update
apt-get remove --purge grub-legacy
apt-get install grub2
# linux command line: blank
# grub install devices: blank
# continue: yes
apt-get --purge autoremove
# remove the old menu.lst
rm /boot/grub/menu.lst
@pascalduez
pascalduez / html.tpl.php
Created December 1, 2011 16:18
Drupal 7 — HTML5 html.tpl.php
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
</head>
<body<?php print $body_attributes;?>>
@weaverryan
weaverryan / FeatureContext.php
Created June 19, 2012 21:05
Behat Definition to help click generic links on different rows of a table
<?php
// ...
class FeatureContext extends MinkContext
{
/**
* Looks for a table, then looks for a row that contains the given text.
* Once it finds the right row, it clicks a link in that row.
*
@AdamMagaluk
AdamMagaluk / gist:3908311
Created October 17, 2012 21:25
libwebsockets - libwebsockets_fork_service_loop
int fd;
struct sockaddr_in cli_addr;
int n;
int p;
n = fork();
if (n < 0)
return n;
if (!n) {
@antoche
antoche / HockeySender.java
Created March 9, 2013 07:44
HockeyApp ACRA sender that inserts all ACRA data (including logs)
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.acra.ACRA;
import org.acra.collector.CrashReportData;
import org.acra.ReportField;
import org.acra.sender.ReportSender;
@owickstrom
owickstrom / state.ex
Last active July 28, 2020 20:52
Exposing a synchronous API in Elixir. Inspired by http://elixir-lang.org/getting_started/mix_otp/3.html.
defmodule State.Counter do
use GenServer
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
## Client API
@doc "Gets the counter's current value."
@heathdutton
heathdutton / gist:cc29284de3934706acd1
Created April 26, 2015 03:19
Start an Acquia drush command, and wait for it to complete before continuing.
#!/bin/bash
# Runs an acquia task, and waits for the task to complete before continuing.
# This is a helper script, to be used in others as needed.
if [[ $1 = "" ]] || [[ $2 = "" ]]
then
echo "Runs an acquia drush command, waiting for the results before continuing."
echo "Can be used as a replacement for drush."
echo
echo " Usage: $0 <site-alias> <ac-drush-command>"
@parties
parties / responsive-fitted-table.jsx
Last active March 13, 2020 20:02
Responsive Wrapper for Facebook's Fixed Data Table
var React = require('react');
var {Table} = require('fixed-data-table');
var _ = require('lodash');
var FittedTable = React.createClass({
getInitialState() {
return {
tableWidth : 400,
tableHeight : 400
};
@SebCorbin
SebCorbin / block.tpl.twig
Last active July 8, 2021 09:50
Drupal Bootstrap theme main templates converted to Twig
<section id="{{ block_html_id }}" class="{{ classes }} clearfix"{{ attributes }}>
{{ title_prefix }}
{% if title %}
<h2{{ title_attributes }}>{{ title }}</h2>
{% endif %}
{{ title_suffix }}
{{ content }}
</section>
@alanpeabody
alanpeabody / my_app.ex
Last active July 18, 2024 05:22
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])