Skip to content

Instantly share code, notes, and snippets.

View rtrvrtg's full-sized avatar
🥫
can check

Geoffrey Roberts rtrvrtg

🥫
can check
View GitHub Profile
@rtrvrtg
rtrvrtg / gist:3d6dbff6395424865aee27026bbe5f54
Created May 30, 2018 08:20
npm: registry.npmjs.org host 151.101.36.162 is down
0 info it worked if it ends with ok
1 verbose cli [ '/home/me/.nvm/versions/node/v6.14.1/bin/node',
1 verbose cli '/home/me/.nvm/versions/node/v6.14.1/bin/npm',
1 verbose cli 'i',
1 verbose cli '--save',
1 verbose cli 'clipboard' ]
2 info using npm@3.10.10
3 info using node@v6.14.1
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
@rtrvrtg
rtrvrtg / gist:a7c1163d7ff2de2aa5a5
Created February 23, 2015 07:23
Fiddling with PureScript types
module Main where
import Control.Monad.Eff
import Data.Maybe
import Debug.Trace
foreign import data ThreeStore :: * -> * -> * -> *
data Chombo (eff :: # !)
foreign import threeStore """
@rtrvrtg
rtrvrtg / gist:6337607
Created August 26, 2013 02:20
all that it takes to make Nokogiri::HTML fuck up
<!DOCTYPE html>
<html>
<head>
<title>hi guys</title>
</head>
<body>
<h1>hello</h1>
</body>
</html>
@rtrvrtg
rtrvrtg / capistrano-drush-funcs.rb
Created July 11, 2013 00:02
Some ruby functions that I use in Capistrano scripts for Drupal deployment. Requires Drush. They're a bit rough, so feel free to mess round with this.
# Determines if an application exists.
def app_exists?(app_name)
begin
false == capture("which #{app_name}").strip.empty?
rescue Exception => e
false
end
end
# Does something in Drush.
@rtrvrtg
rtrvrtg / circle.php
Last active December 18, 2015 15:19 — forked from anonymous/circle.php
<div style="position: absolute;">
<?php
function circle($radius = 10, $center = array(0, 0), $points = 20) {
$point_array = array();
for ($i = 0; $i < $points; $i++) {
$theta = 2 * pi() * ($i / $points);
$x = $radius * sin($theta) + $center[0];
$y = $radius * cos($theta) + $center[1];
array_push($point_array, array($x, $y));
$template_path = isset($registry[$theme]['path']) ? $registry[$theme]['path'] . '/' : './';
$template_theme_path = isset($registry[$theme]['theme path']) ? $registry[$theme]['theme path'] . '/templates/' : './';
if (file_exists($template_path . $template)) {
$hint = t('File found in folder @template-path', array('@template-path' => $template_path));
$template = '<strong title="'. $hint .'">' . $template . '</strong>';
}
elseif (file_exists($template_theme_path . $template)) {
$hint = t('File found in folder @template-path', array('@template-path' => $template_theme_path));
$template = '<strong title="'. $hint .'">' . $template . '</strong>';
}
public function defaultScope()
{
return array(
'condition'=>'deleted=0',
);
}
public function defaultScope()
{
var functions = [
function(){ document.write('1'); },
function(){ document.write('2'); },
function(){ document.write('3'); },
], finished = [];
while (finished.length < functions.length) {
var current = Math.floor(Math.random() * functions.length);
if (finished.indexOf(current) >= 0) continue;
@rtrvrtg
rtrvrtg / gist:5196274
Created March 19, 2013 13:52
test if mod_rewrite works: redirects /hi-there to /hello.html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^hi-there hello.html [L]
</IfModule>
@rtrvrtg
rtrvrtg / git-merge-push
Created November 26, 2012 22:45
A git helper to quickly merge and push branches
#!/bin/bash
# git-merge-push thatbranch
THISBRANCH=$(git rev-parse --abbrev-ref HEAD)
THATBRANCH=$1
git checkout $THATBRANCH && git merge $THISBRANCH && git push origin $THATBRANCH && git checkout $THISBRANCH