Skip to content

Instantly share code, notes, and snippets.

View softquantum's full-sized avatar

Maxime softquantum

View GitHub Profile
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@softquantum
softquantum / Csv.php
Created February 9, 2017 20:29 — forked from barryvdh/Csv.php
<?php
class Csv
{
public static function fromArray($rows, $delimiter = ',')
{
if (empty($rows)) {
return '';
}
@softquantum
softquantum / Xml.php
Created February 9, 2017 20:30 — forked from barryvdh/Xml.php
XML Helper (from/to array)
<?php
use SimpleXMLElement;
class Xml {
/**
* @param array $data
* @param string $root
* @return SimpleXMLElement
@softquantum
softquantum / Excel.php
Created February 9, 2017 20:32 — forked from barryvdh/Excel.php
Simple php-excel class to load an Excel file into an array (using Laravel json/array interface, but you don't have to use that). Don't forget to require https://packagist.org/packages/phpoffice/phpexcel or https://packagist.org/packages/codeplex/phpexcel
<?php
use Illuminate\Support\Contracts\ArrayableInterface;
use Illuminate\Support\Contracts\JsonableInterface;
class Excel implements ArrayableInterface, JsonableInterface{
protected $objPHPExcel;
public function __construct($file){
if($file instanceof \SplFileInfo){
$filename = $file->getRealPath();
{"help": "https://catalog.data.gov/api/3/action/help_show?name=package_search", "success": true, "result": {"count": 48, "sort": "views_recent desc", "facets": {}, "results": [{"license_title": "License not specified", "maintainer": "New Media", "relationships_as_object": [], "private": false, "maintainer_email": "newmedia@whitehouse.gov", "num_tags": 5, "id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "metadata_created": "2016-07-02T10:06:26.199575", "metadata_modified": "2016-07-02T10:06:26.199575", "author": null, "author_email": null, "state": "active", "version": null, "creator_user_id": "47303a9e-1187-4290-85a3-1fc02dc49e4a", "type": "dataset", "resources": [{"cache_last_updated": null, "package_id": "59694770-b6b6-4ae0-a4b9-4ae69c0be2f6", "webstore_last_updated": null, "id": "3a8a0ad1-19e7-4153-bb2f-d70cf88aaaf8", "size": null, "state": "active", "hash": "", "description": "", "format": "CSV", "tracking_summary": {"total": 32, "recent": 1}, "last_modified": null, "url_type": null, "no_real_name": "True",
@softquantum
softquantum / pagination.md
Created April 4, 2017 19:38 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@softquantum
softquantum / pagination.md
Created April 4, 2017 19:38 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@softquantum
softquantum / README.md
Created July 8, 2017 09:53 — forked from bsergean/README.md
three.js + headless.gl rendering with texturing

Getting the code

git clone https://gist.github.com/08be90a2f21205062ccc.git

Executing the code

$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png

> offscreen-sample@1.0.0 start /Users/bsergean/src/offscreen_sample

@softquantum
softquantum / texture_change.py
Created July 9, 2017 20:35 — forked from diramazioni/texture_change.py
blender python: texture change from command line
'''
texture image path are relative to the blend file directory. run from command line like this:
texture=img/2012720989_c.jpg blender -b mug.blend --python texture_change.py -F PNG -s 1 -e 1 -j 1 -t 0 -a
''''
import os
image_file = os.getenv('texture')
if not image_file:
image_file="img/2012720989_c.jpg"
@softquantum
softquantum / 1.Summary.md
Created February 3, 2018 19:03 — forked from Vercoutere/1.Summary.md
Laravel 5 middleware class that sets a context in a multi-tenant app + updated version for easier testing with example testcase.