Skip to content

Instantly share code, notes, and snippets.

View raedatoui's full-sized avatar

Raed Atoui raedatoui

View GitHub Profile
@ameliemaia
ameliemaia / three-examples-converter.js
Last active November 26, 2018 03:32
Convert threejs examples js to es6 - slightly hacky but works
var fs = require('fs');
require('shelljs/global');
const EXAMPLES_DIR = './node_modules/three/examples/js'
const DEST_DIR = './src/js/lib/three/examples'
mkdir('-p', DEST_DIR);
const files = [
`${EXAMPLES_DIR}/loaders/GLTFLoader.js`,
@rdoursenaud
rdoursenaud / gae-test-skip-files.py
Created October 20, 2016 15:25
Test Google App Engine app.yaml skip-files regexes without deploying
#!/usr/bin/env python2.7
# encoding=utf8
#
# Copyright 2007 Google Inc.
# Copyright 2016 Raphaël Doursenaud
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@atomtigerzoo
atomtigerzoo / wordpress-hide-editor-on-pages.php
Last active December 29, 2020 17:25 — forked from ramseyp/hide-editor.php
Wordpress: Hide the editor on defined pages
/**
* Hide the main editor on specific pages
*/
define('EDITOR_HIDE_PAGE_TITLES', json_encode(array()));
define('EDITOR_HIDE_PAGE_TEMPLATES', json_encode(array('template-cars.php')));
/**
* Hide the main editor on defined pages
*
@ghinda
ghinda / object-to-form-data.js
Last active March 30, 2024 18:51
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev
@ekristen
ekristen / check_docker_container.sh
Last active January 16, 2024 16:15
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@aseemk
aseemk / coffeescript-updates.md
Last active December 2, 2017 20:22
CoffeeScript upcoming changes.

CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.

Parentheses-free chaining

jashkenas/coffeescript#3263

Years of being wished for, finally granted!

@rb2k
rb2k / gist:8372402
Last active April 15, 2024 19:30
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@pcreux
pcreux / cancan_use_subqueries.rb
Created July 23, 2013 17:25
Monkey patch Cancan to use subqueries. Work around for complex conditions with deep joins.
require 'cancan/model_adapters/active_record_adapter'
class CanCan::ModelAdapters::ActiveRecordAdapter
# From CanCan
def database_records
if override_scope
@model_class.scoped.merge(override_scope)
elsif @model_class.respond_to?(:where) && @model_class.respond_to?(:joins)
mergeable_conditions = @rules.select {|rule| rule.unmergeable? }.blank?
if mergeable_conditions