Skip to content

Instantly share code, notes, and snippets.

View felixmc's full-sized avatar

Felix Milea-Ciobanu felixmc

  • Facebook
  • Bay Area
View GitHub Profile
#!/usr/bin/env node
const path = require('path')
const exec = require('child_process').exec
const cmd = `ag "import .* from '" -G "${process.argv[2] || 'lib/'}" --nogroup | sed -e "s/:.*from//g" -e "s/'//g" | sed "s/^\\(.*\\.js\\) \\(.*\\)$/\\1 \\2/"`
exec(cmd, (error, stdout, stderr) => {
if (error) {
console.error('Error ocurred:', error)
} else {
object RedFlashSketch extends ProcessingSketch {
val redInterpolation = new Interpolation( 0, 255, 60, Interpolation.easeInOutSine, Interpolation.Direction.Alternate )
override def draw() {
background( new RGBColor( red = redInterpolation.value, green = 0, blue = 0 ) )
redInterpolation.update
}
}
Interpolation( start: Float, end: Float, duration: Float = 120f, fn: ( Float, Float, Float, Float ) => Float = Interpolation.linear,
repeat: Float = Float.PositiveInfinity, direction: Interpolation.Direction.Direction = Interpolation.Direction.Normal )
val cyan = new HSBColor(hue = 180, saturation = 65)
val bgColor: RGBColor = cyan
override def draw() {
background( bgColor )
stroke( new RGBColor(red = 255, green = 200, blue = 150) )
// draw something
}
@felixmc
felixmc / routes.php
Last active December 29, 2015 19:19
<?php
/*
* Load controllers for setting up manual controller routes to allow for dynamic custom page routes
* */
$controllers = array();
foreach (scandir( APPPATH . "controllers" ) as $file) {
$fileParts = explode(".", $file);
if ($fileParts[1] === "php")
array_push($controllers, $fileParts[0]);
<?php
class StaticPage extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('static_page_model');
}
public function index () {
$slug = $this->uri->segment(1);
@felixmc
felixmc / static_page_model.php
Last active December 29, 2015 16:29
simple code igniter model for a
<?php
class Static_Page_Model extends CI_Model {
function __construct() {
// Call the Model constructor
parent::__construct();
}
public function createPage ($data) {
$data['date_created'] = date('Y-m-d H:i:s');
@felixmc
felixmc / dabblet.css
Created June 24, 2013 00:49
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<?php
$host = $_SERVER["HTTP_HOST"];
$uri = ($host === $_SERVER["SERVER_NAME"] || $_SERVER["SERVER_NAME"] !== "localhost" ? "/wamp" : "") . "/wordpress";
$base_url = "http://" . $host . $uri;
define('WP_HOME', $base_url);
define('WP_SITEURL', $base_url);
?>
@felixmc
felixmc / nginx.conf
Last active December 18, 2015 00:59
location /wamp/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000/;
proxy_redirect off;
}