Skip to content

Instantly share code, notes, and snippets.

@badsyntax
badsyntax / build.sh
Created January 11, 2011 20:56
An example PHP & BASH Post-Receive github web hook to package projects
#! /usr/bin/env bash
#clone the repo
git clone -q "${1}" "clones/${2}"
cd "clones/${2}"
#update the submodules (how do we handle errors here?)
git submodule --quiet update --init --recursive
@anthonyholmes
anthonyholmes / spreadsheet.php
Last active June 23, 2018 14:58
PHP Class for Accessing Data from Google Docs Spreadsheet
<?php
Class DocDB {
private $key;
private $url;
private $file;
private $json;
private $rows;
private $data = array();
private $columns = array();
@rutoru
rutoru / IlluminateDB.php
Created May 14, 2014 14:06
How to use transaction with Laravel's Eloquent ORM and the Slim Framework
<?php
/**
* Illuminate DB Class
*
* @author rutoru
* @package Runa-CCA
* @license http://www.opensource.org/licenses/mit-license.php 2014 rutoru
*/
namespace Runa_CCA\Model;
@james2doyle
james2doyle / simple-json-reponse.php
Last active March 7, 2024 06:02
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($code = 200, $message = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@GuiSevero
GuiSevero / svn stash.txt
Created July 25, 2016 19:56
SVN "git stash" alternative
set PATH=%PATH%;C:\Program Files\TortoiseSVN\bin
git stash: svn diff > patch_name.patch; svn revert -R .
git stash apply: patch patch_name.patch
based on stackoverflow answer: http://stackoverflow.com/questions/1554278/temporarily-put-away-uncommited-changes-in-subversion-a-la-git-stash
@Ruin0x11
Ruin0x11 / mpv-gif.lua
Last active March 26, 2024 01:01
Create animated GIFs using mpv
-- Create animated GIFs with mpv
-- Requires ffmpeg.
-- Adapted from http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
-- Usage: "g" to set start frame, "G" to set end frame, "Ctrl+g" to create.
local msg = require 'mp.msg'
-- Set this to the filters to pass into ffmpeg's -vf option.
-- filters="fps=24,scale=320:-1:flags=lanczos"
filters="fps=15,scale=540:-1:flags=lanczos"
@rvanzon
rvanzon / nuxt.config.js
Last active September 1, 2022 13:25
A way to use vue-chartjs as a plugin of Nuxt.js
// just an example. A cleaner way is to wrap the showLine-stuff in a dedicated component
<template>
<div>
<my-line v-if="showLine" :data="lineData" :options="options">
</div>
</template>
<script>
export default {
data () {
@simonhamp
simonhamp / AppServiceProvider.php
Last active June 12, 2024 11:05
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@sebastiencs
sebastiencs / volume.sh
Last active February 13, 2024 11:19
Script to get volume notification with dunst http://imgur.com/a/qWgAw
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}