Skip to content

Instantly share code, notes, and snippets.

View nathanclark's full-sized avatar

Nathan Clark nathanclark

View GitHub Profile
@nathanclark
nathanclark / _form.html.erb
Created November 4, 2022 17:27
Nested Attributes Example
<% cancel_path ||= company.persisted? ? [:account, company] : [:account, @team, :companies] %>
<%= form_with model: company, url: (company.persisted? ? [:account, company] : [:account, @team, :companies]), local: true, class: 'form' do |form| %>
<%= render "shared/limits/form", form: form, cancel_path: cancel_path do %>
<%= render 'account/shared/forms/errors', form: form %>
<% with_field_settings form: form do %>
<%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
<%= render 'shared/fields/text_field', method: :legal_name %>
<%= render 'shared/fields/text_field', method: :ein %>
<% if current_user %>
<script>
var pusher = new Pusher('HIDDEN', { authEndpoint: '/pusher/auth' , cluster: 'HIDDEN',
auth: {
headers: {
'X-CSRF-Token': "<%= form_authenticity_token %>"
}
}
});
webpack is watching the files…
[BABEL] Note: The code generator has deoptimised the styling of /Users/nathanclark/Documents/ProsperityErpMobile/mobileapp/node_modules/@vue/devtools/build/backend.js as it exceeds the max of 500KB.
Hash: 723bbc61bad5fcebb853
Version: webpack 4.27.1
Time: 10577ms
Built at: 12/13/2019 2:49:02 PM
Asset Size Chunks Chunk Names
assets/images/NativeScript-Vue.png 8.22 KiB [emitted]
@nathanclark
nathanclark / video.js
Created January 18, 2018 06:57
video.js
import Route from '@ember/routing/route';
export default Route.extend({
model: function(params,transition) {
let artist_id = transition.params["artists.show"].id;
var video = this.store.query('artist', {"artist_id":artist_id , "video": params.guid })
.then(function (asset) {
// How to I pass the guid into the function?
console.log(params.guid) // params.guid == undefined because it is out f scope.
@nathanclark
nathanclark / controllers.application.js
Created January 18, 2018 06:55
aritists video details
import Route from '@ember/routing/route';
export default Route.extend({
model: function(params,transition) {
let artist_id = transition.params["artists.show"].id;
var videos = this.store.query('artist', {"artist_id":artist_id , "videos": params.guid })
.then(function (a) {
// How to I pass the guid into the function?
console.log(params.guid) // params.guid == undefined because it is out f scope.
@nathanclark
nathanclark / Body.jsx
Last active April 21, 2017 06:42
Body.jsx
import { Components, getSetting, registerComponent } from 'meteor/vulcan:lib';
import React, { PropTypes, Component } from 'react';
class Body extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
document.getElementById('body').className="page-header-fixed page-sidebar-closed-hide-logo page-content-white"
// An example of how to trigger a random timer with a floor of 1 and a ceiling of 4;
-(void)random{
int randNum = rand() % (4 - 1) + 1; //create the random number.
NSLog(@"[DEBUG] random triggered %i", randNum);
// Choosing a random sound effect
NSString *filename = [NSString stringWithFormat:@"soundEffect%i",randNum];
NSString *filePath = [[NSBundle mainBundle] pathForResource:filename ofType:@"caf"];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:[NSURL fileURLWithPath:filePath]
#import "CCScene.h"
#import "Fly.h"
@interface PageScene1 : PageScene
Fly *fly;
@end
// If the 1st suffix is not found and if fallback is enabled then fallback suffixes are going to searched. If none is found, it will try with the name without suffix.
// On iPad HD : "-ipadhd", "-ipad", "-hd"
// On iPad : "-ipad", "-hd"
// On iPhone HD: "-hd"
CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setEnableFallbackSuffixes:NO]; // Default: NO. No fallback suffixes are going to be used
[sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"]; // Default on iPhone RetinaDisplay is "-hd"
[sharedFileUtils setiPadSuffix:@"-ipad"]; // Default on iPad is "ipad"
[sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"]; // Default on iPad RetinaDisplay is "-ipadhd"
@nathanclark
nathanclark / iOSDocumentMigrator.m
Created February 21, 2012 20:43 — forked from naokits/iOSDocumentMigrator.m
Helps migrating documents between iOS <= 5.0 and >= 5.0.1 to comply with Apple's iCloud guidelines. Follow @steipete on Twitter for updates.
#include <sys/xattr.h>
/// Set a flag that the files shouldn't be backuped to iCloud.
+ (void)addSkipBackupAttributeToFile:(NSString *)filePath {
u_int8_t b = 1;
setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}
/// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available.
+ (NSString *)legacyStoragePath {