Skip to content

Instantly share code, notes, and snippets.

View j0k3r's full-sized avatar

Jérémy Benoist j0k3r

View GitHub Profile
@j0k3r
j0k3r / machine.js
Last active November 17, 2021 08:17
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'proofreading',
initial: 'unread',
states: {
unread: {
on: {
ASK_PROOFREADING: 'submitted_proofreading',
},
},
submitted_proofreading: {
@j0k3r
j0k3r / machine.js
Last active January 6, 2023 15:37
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'publication',
initial: 'draft',
states: {
draft: {
on: {
PUBLISH: 'published',
SCHEDULE: 'scheduled',
FROZE: 'frozen',
DELETE: 'deleted',
@j0k3r
j0k3r / Dockerfile
Last active March 28, 2019 18:23
Fix 404 when retrieving package from jessie-updates
FROM debian:jessie
RUN sed -i '/jessie\-updates/d' /etc/apt/sources.list \
&& echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until
RUN apt-get update
# etc...

Keybase proof

I hereby claim:

  • I am j0k3r on github.
  • I am j0k (https://keybase.io/j0k) on keybase.
  • I have a public key ASBc10HMzZ8qQQMykV78NkiCTPzwuFkrJ3SBAAt_Nt-qrAo

To claim this, I am signing this object:

@j0k3r
j0k3r / gist:1985336
Created March 6, 2012 09:40
`loadHelpers` without using `sfContext::getInstance()`
<?php
// instead of using
sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
// use
sfApplicationConfiguration::getActive()->loadHelpers(array('Url'));
@j0k3r
j0k3r / colorize-svn.sh
Created March 2, 2012 15:03 — forked from johnjohndoe/colorize-svn.sh
Colorize SVN & SVN DIFF
# Colorize SVN
# ------------
# Adds color to the output of commands like svn status and svn update.
# The original version of the script was posted by Ash_ on Stackoverflow
# Source: http://stackoverflow.com/questions/8786400/svn-add-colors-on-command-line-svn-with-awk-in-bash
function svn {
# Skip the color script when running an svn commit.
for x in "$@"; do
if [ $x = commit ] || [ $x = ci ]; then
command svn "$@";
@j0k3r
j0k3r / gist:1116875
Created July 31, 2011 15:11
removes these fsckin' cp-1252 characters from $text
<?php
// from @ubermuda: https://twitter.com/#!/ubermuda/status/85465832217518080
preg_replace('/[^(\x20-\x7F)]+/', '', $text);
@j0k3r
j0k3r / Utils.class.php
Created July 19, 2011 10:31
well well well
<?php
public static function hideInProd(){
if(sfConfig::get('sf_environment') == 'prod'){
return " style=\"display:none;\"";
}
}
@j0k3r
j0k3r / gist:1043634
Created June 23, 2011 21:09
http auth on *_dev.php file for lighttpd
$HTTP["url"] =~ "^/(front|back)end_dev"
{
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/path/to/.passwdstats"
auth.require =
( "" =>
(
"method" => "basic",
"realm" => "auth required",
"require" => "valid-user"
@j0k3r
j0k3r / gist:1042518
Created June 23, 2011 13:22
format_number_choice
<?php
echo format_number_choice(
'[0] aucun commentaire|[1] 1 commentaire|(1, +Inf] %1% commentaires',
array('%1%' => $nb_results),
$nb_results
)
?>