Skip to content

Instantly share code, notes, and snippets.

View jameswritescode's full-sized avatar
✍️

James Newton jameswritescode

✍️
View GitHub Profile
@jameswritescode
jameswritescode / gist:96134f90e43d6cb0f79193e7941856fc
Created May 8, 2017 22:50 — forked from andyjbas/gist:9962218
Disable CSS Animations in Poltergeist & Phantomjs. Phantomjs does not like to wait for animations, and you can run in to nasty test flickers because of it. This pattern will disable animations in test env, and not touch any app code.
# env.rb or spec_helper.rb

Capybara.register_driver :poltergeist do |app|
  opts = {
    extensions: ["#{Rails.root}/features/support/phantomjs/disable_animations.js"] # or wherever
  }

  Capybara::Poltergeist::Driver.new(app, opts)
end
group = Group.find(GROUP_ID_HERE)
user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id)
group.add_users(user_ids, GroupMember::DEVELOPER)
group.add_users(admin_ids, GroupMember::OWNER)
class CreateUserService
attr_reader :current_user
def initialize(current_user)
@current_user = current_user
end
def execute(user_params)
raise "must be admin" unless current_user.is_admin?
opts = {
Doctors - 08/20/2016
Is there any way I record voice using voice_packet from discord::voice::AudioReceiver?(edited)
SpaceManịac - 08/20/2016
@Doctors It's possible, yes - data is just audio in PCM form like you'd find in a .wav file
Doctors - 08/20/2016
So I should be able to send data to a file (like a .wav)? Any suggestions as to how I would do so?
SpaceManịac - 08/20/2016
The hound crate can be used for writing .wav files
Nick - 08/20/2016
Yeah, wav will be the easiest, for any other format you'll have to use something like ffmpeg to convert the the input (and dear god, don't try to write c bindings for it, it's a terrible API)
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace DotNetMVCTest
{
public class DefinitionOrderer : ITestCaseOrderer
{
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace DotNetMVCTest
{
public class DefinitionOrderer : ITestCaseOrderer
{
/**
* If a prefix is provided, the value will be prepended to the routes defined.
*
* It is optional to override the controller name if prefix is being used, so
* with the example given it would create routes like this:
*
* /users/:user_id/pets
* /users/:user_id/pets/:pet_id
**/
exports.prefix = '/users/:user_id';
@jameswritescode
jameswritescode / gist:8f88a562743f0ad0e37b
Created August 27, 2015 18:27
pluralsight slack theme
#58595B,#464547,#FF681D,#F8F8F8,#62B1BD,#FFFFFF,#A3D55F,#FF681D
import unittest
import inspect
import nose
import sys
import traceback
class MyTest(unittest.TestCase):
def test_failing(self):
self.assertTrue(False)