Skip to content

Instantly share code, notes, and snippets.

View frazras's full-sized avatar
💭
Coding for honey 🍯

Rohan Smith frazras

💭
Coding for honey 🍯
View GitHub Profile
@loushou
loushou / main.dart
Last active October 31, 2021 18:22
Flutter - Programmatically trigger button without directly tapping it #flutter #statemanagement #provider
/*
The goal of this is to show you how to abstract the action of tapping a button,
such that it can be triggered from some other code. In this case we trigger one
button's action from tapping another button... but the principle should carry
over if you are triggering it from somewhere else in the code as well, possibly
not related to a user button tap (maybe after a certain amount of time, or when
another state updates elsewhere in the code).
*/
// this package provides the state management utilities we need for this magic to happen
@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
"""
An alternative text clip for Moviepy, relying on Gizeh instead of ImageMagick
Advantages:
- Super fast (20x faster)
- no need to install imagemagick
- full-vector graphic, no aliasing problems
- Easier font names
Disadvantages:
@0xjac
0xjac / private_fork.md
Last active April 23, 2024 14:56
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@mehdichaouch
mehdichaouch / memory_usage.php
Last active April 11, 2024 15:55
PHP Snippet to get human readable memory usage
<?php
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
convert(memory_get_usage());
@nrollr
nrollr / ApacheHTTPSConfig.md
Last active March 11, 2024 13:32
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

@joepie91
joepie91 / vpn.md
Last active April 20, 2024 21:15
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@ry8806
ry8806 / jplayer-directive.js
Last active May 20, 2016 14:44
AngularJS and jPlayer directive
myApp.directive("jplayer", ['$window', 'PlayerService', function ($window, PlayerService) {
return {
restrict: "E",
// Have our own scope - we only want to watch the service and not conflict with other scopes
scope: {},
// Serve up some html with our player
templateUrl: "/jplayer-template.html",
link: function (scope, element, attrs) {
// An element on the page to attach the jPlayer to. Could also use "element" from linkFN ^
var jPlayer = angular.element("#jquery_jplayer_1").jPlayer();
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
xdebug.remote_host=localhost
;xdebug.profiler_enable_trigger=1
;xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128
@phanan
phanan / runner.js
Last active September 22, 2022 11:05
Record a webpage with PhantomJS and FFMpeg
// Run this from the commandline:
// phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
var page = require('webpage').create(),
address = 'http://s.codepen.io/phanan/fullembedgrid/YPLewm?type=embed&safe=true&_t=1424767252279',
duration = 3, // duration of the video, in seconds
framerate = 24, // number of frames per second. 24 is a good value.
counter = 0,
width = 500,
height = 500;